浏览代码

Merge pull request #33 from anki-code/patch-2

Fix: tests for 2.7 and 3.5
Valentin 4 年之前
父节点
当前提交
90076c2773
共有 1 个文件被更改,包括 10 次插入3 次删除
  1. 10 3
      python_appimage/commands/build/app.py

+ 10 - 3
python_appimage/commands/build/app.py

@@ -228,8 +228,15 @@ def execute(appdir, name=None, python_version=None, linux_tag=None,
 
         # Bundle the requirements
         if requirements_list:
-            deprecation = 'DEPRECATION: Python 2.7 reached the end of its life'
-            system(('./AppDir/AppRun', '-m', 'pip', 'install', '-U', '--use-feature=in-tree-build',
+            pip_version = system(('./AppDir/AppRun','-m', 'pip','--version')).split(' ')[1]
+            in_tree_build = '' if pip_version < '21' else '--use-feature=in-tree-build'
+
+            deprecation = (
+                'DEPRECATION: Python 2.7 reached the end of its life',
+                'DEPRECATION: Python 3.5 reached the end of its life'
+            )
+
+            system(('./AppDir/AppRun', '-m', 'pip', 'install', '-U', in_tree_build,
                    '--no-warn-script-location', 'pip'), exclude=deprecation)
             for requirement in requirements_list:
                 if requirement.startswith('git+'):
@@ -237,7 +244,7 @@ def execute(appdir, name=None, python_version=None, linux_tag=None,
                     log('BUNDLE', name + ' from ' + url[4:])
                 else:
                     log('BUNDLE', requirement)
-                system(('./AppDir/AppRun', '-m', 'pip', 'install', '-U', '--use-feature=in-tree-build',
+                system(('./AppDir/AppRun', '-m', 'pip', 'install', '-U', in_tree_build,
                        '--no-warn-script-location', requirement),
                        exclude=(deprecation, '  Running command git clone -q'))