From 4ce4a09ca96dc879db784fec888bc80a5e467544 Mon Sep 17 00:00:00 2001 From: Mohamed Feddad Date: Thu, 9 Dec 2021 00:01:02 +0400 Subject: [PATCH] Add --no-tree-build flag resolves #40 --- python_appimage/__main__.py | 4 ++++ python_appimage/commands/build/app.py | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/python_appimage/__main__.py b/python_appimage/__main__.py index 34804c0..b2a378a 100644 --- a/python_appimage/__main__.py +++ b/python_appimage/__main__.py @@ -70,6 +70,10 @@ def main(): help='python compatibility tag (e.g. cp37-cp37m)') build_app_parser.add_argument('-p', '--python-version', help='python version (e.g. 3.8)') + build_app_parser.add_argument('--no-tree-build', + help='omits pip in-tree-build flag', + action='store_true', + default=False) which_parser = subparsers.add_parser('which', description='Locate a binary dependency') diff --git a/python_appimage/commands/build/app.py b/python_appimage/commands/build/app.py index a88a982..ceefc3a 100644 --- a/python_appimage/commands/build/app.py +++ b/python_appimage/commands/build/app.py @@ -25,13 +25,13 @@ def _unpack_args(args): '''Unpack command line arguments ''' return args.appdir, args.name, args.python_version, args.linux_tag, \ - args.python_tag, args.base_image + args.python_tag, args.base_image, args.no_tree_build _tag_pattern = re.compile('python([^-]+)[-]([^.]+)[.]AppImage') def execute(appdir, name=None, python_version=None, linux_tag=None, - python_tag=None, base_image=None): + python_tag=None, base_image=None, no_tree_build=False): '''Build a Python application using a base AppImage ''' @@ -229,7 +229,11 @@ def execute(appdir, name=None, python_version=None, linux_tag=None, # Bundle the requirements if requirements_list: pip_version = system(('./AppDir/AppRun','-m', 'pip','--version')).split(' ')[1] - in_tree_build = '' if pip_version < '21' else '--use-feature=in-tree-build' + + if pip_version < '21' or no_tree_build: + in_tree_build = '' + else: + in_tree_build = '--use-feature=in-tree-build' deprecation = ( 'DEPRECATION: Python 2.7 reached the end of its life',