From dd611db8e47b5c8bd8b63db37709a5433678b87c Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 3 Apr 2020 15:26:42 +0200 Subject: Update scripts from master --- scripts/dev/build_release.py | 12 ++---------- scripts/dev/recompile_requirements.py | 29 +++++++++++++++++++++-------- scripts/mkvenv.py | 4 +++- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/scripts/dev/build_release.py b/scripts/dev/build_release.py index 228b4888a..95ce66473 100755 --- a/scripts/dev/build_release.py +++ b/scripts/dev/build_release.py @@ -141,17 +141,9 @@ def patch_mac_app(): with open(plist_path, "wb") as f: plistlib.dump(plist_data, f) - # Copy missing QtQmlModels - # WORKAROUND for https://github.com/pyinstaller/pyinstaller/issues/4631 - app_lib_path = os.path.join(app_path, 'Contents', 'MacOS', - 'PyQt5', 'Qt', 'lib') - tox_lib_path = os.path.join('.tox', 'pyinstaller', 'lib', 'python3.7', - 'site-packages', 'PyQt5', 'Qt', 'lib') - shutil.copytree(os.path.join(tox_lib_path, 'QtQmlModels.framework'), - os.path.join(app_lib_path, 'QtQmlModels.framework')) - # Replace some duplicate files by symlinks - framework_path = os.path.join(app_lib_path, 'QtWebEngineCore.framework') + framework_path = os.path.join(app_path, 'Contents', 'MacOS', 'PyQt5', + 'Qt', 'lib', 'QtWebEngineCore.framework') core_lib = os.path.join(framework_path, 'Versions', '5', 'QtWebEngineCore') os.remove(core_lib) diff --git a/scripts/dev/recompile_requirements.py b/scripts/dev/recompile_requirements.py index 84cc155e3..db3d0dd2a 100644 --- a/scripts/dev/recompile_requirements.py +++ b/scripts/dev/recompile_requirements.py @@ -113,6 +113,19 @@ def get_all_names(): yield basename[len('requirements-'):-len('.txt-raw')] +def init_venv(host_python, tmpdir, filename): + subprocess.run([host_python, '-m', 'venv', tmpdir], check=True) + + venv_python = os.path.join(tmpdir, 'bin', 'python') + subprocess.run([venv_python, '-m', 'pip', + 'install', '-U', 'pip'], check=True) + + subprocess.run([venv_python, '-m', 'pip', + 'install', '-r', filename], check=True) + subprocess.run([venv_python, '-m', 'pip', 'check'], check=True) + return venv_python + + def main(): """Re-compile the given (or all) requirement files.""" names = sys.argv[1:] if len(sys.argv) > 1 else sorted(get_all_names()) @@ -136,15 +149,10 @@ def main(): else: host_python = sys.executable - with tempfile.TemporaryDirectory() as tmpdir: - subprocess.run([host_python, '-m', 'venv', tmpdir], check=True) + utils.print_subtitle("Building") - venv_python = os.path.join(tmpdir, 'bin', 'python') - subprocess.run([venv_python, '-m', 'pip', - 'install', '-U', 'pip'], check=True) - - subprocess.run([venv_python, '-m', 'pip', - 'install', '-r', filename], check=True) + with tempfile.TemporaryDirectory() as tmpdir: + venv_python = init_venv(host_python, tmpdir, filename) proc = subprocess.run([venv_python, '-m', 'pip', 'freeze'], check=True, stdout=subprocess.PIPE) reqs = proc.stdout.decode('utf-8') @@ -163,6 +171,11 @@ def main(): for line in comments['add']: f.write(line + '\n') + # Test resulting file + utils.print_subtitle("Testing") + with tempfile.TemporaryDirectory() as tmpdir: + init_venv(host_python, tmpdir, outfile) + if __name__ == '__main__': main() diff --git a/scripts/mkvenv.py b/scripts/mkvenv.py index 3a62cd801..6dc52b82e 100644 --- a/scripts/mkvenv.py +++ b/scripts/mkvenv.py @@ -52,7 +52,7 @@ def parse_args() -> argparse.Namespace: default='auto', help="PyQt version to install.") parser.add_argument('--pyqt-type', - choices=['binary', 'source', 'link'], + choices=['binary', 'source', 'link', 'skip'], default='binary', help="How to install PyQt/Qt.") parser.add_argument('--virtualenv', @@ -270,6 +270,8 @@ def main() -> None: install_pyqt_source(venv_dir, args.pyqt_version) elif args.pyqt_type == 'link': install_pyqt_link(venv_dir) + elif args.pyqt_type == 'skip': + pass else: raise AssertionError -- cgit v1.2.3-54-g00ecf