From e8c79c64942682722fdae2f16edb3ae5eef79599 Mon Sep 17 00:00:00 2001 From: Frank Stettner Date: Wed, 9 Jun 2021 07:44:23 +0200 Subject: [PATCH] Use environment variable $ARCH when available --- appimagecraft/generators/appimage_build_script.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/appimagecraft/generators/appimage_build_script.py b/appimagecraft/generators/appimage_build_script.py index 118ee12..bb9aaf1 100644 --- a/appimagecraft/generators/appimage_build_script.py +++ b/appimagecraft/generators/appimage_build_script.py @@ -1,3 +1,4 @@ +import os import platform import re import shlex @@ -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"] + else: + arch = self._config.get("arch", platform.machine()) valid_archs = ["x86_64", "i386"] @@ -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",