From f22df6d4d6e194ad0c5d1e899dd6353126f36f58 Mon Sep 17 00:00:00 2001 From: peng_langyuan Date: Wed, 17 May 2023 13:31:44 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat(Adapt=20to=20Openeuler):=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2python=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.py | 11 ++++++++++- hb/__main__.py | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/build.py b/build.py index c8827ec..a94ad4b 100755 --- a/build.py +++ b/build.py @@ -25,7 +25,16 @@ import subprocess def get_python(): hb_main = importlib.import_module("hb.__main__") topdir = hb_main.find_top() - python_base_dir = os.path.join(topdir, 'prebuilts/python') + index = 0 + while index < len(sys.argv): + if sys.argv[index] == "-p": + product_name = sys.argv[index + 1] + index += 1 + if product_name == "openeuler": + python_base_dir = "/usr/bin" + else: + python_base_dir = os.path.join(topdir, 'prebuilts/python') + python_base_dir = "/usr/bin" if os.path.exists(python_base_dir): python_dir = hb_main.search(python_base_dir, 'python3') return os.path.join(python_dir, 'python3') diff --git a/hb/__main__.py b/hb/__main__.py index 4db4a55..cf9b7e2 100644 --- a/hb/__main__.py +++ b/hb/__main__.py @@ -53,7 +53,16 @@ def main(): topdir = find_top() except Exception as ex: return print("hb_error: Please call hb utilities inside source root directory") - python_base_dir = os.path.join(topdir, 'prebuilts/python') + index = 0 + while index < len(sys.argv): + if sys.argv[index] == "-p": + product_name = sys.argv[index + 1] + index += 1 + if product_name == "openeuler": + python_base_dir = "/usr/bin" + else: + python_base_dir = os.path.join(topdir, 'prebuilts/python') + python_base_dir = "/usr/bin" if os.path.exists(python_base_dir): python_dir = search(python_base_dir, 'python3') python_executable = os.path.join(python_dir, 'python3') -- 2.33.0