Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use environment variable $ARCH when available #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions appimagecraft/generators/appimage_build_script.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import platform
import re
import shlex
Expand All @@ -20,7 +21,10 @@ def __init__(self, ld_config: dict = None):
def build_file(self, path: str):
gen = BashScriptGenerator(path)

arch = self._config.get("arch", platform.machine())
if "ARCH" in os.environ:
arch = os.environ["ARCH"]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should provide a warning that signalizes to the user that data from the environment was taken into account.

else:
arch = self._config.get("arch", platform.machine())

valid_archs = ["x86_64", "i386"]

Expand Down Expand Up @@ -50,10 +54,11 @@ def build_file(self, path: str):
])

# export architecture, might be used by some people
gen.add_lines([
"export ARCH={}".format(shlex.quote(arch)),
"",
])
if "ARCH" not in os.environ:
gen.add_lines([
"export ARCH={}".format(shlex.quote(arch)),
"",
])

gen.add_lines([
"# fetch linuxdeploy from GitHub releases",
Expand Down