Mercurial > hg
comparison contrib/packaging/hgpackaging/inno.py @ 41912:d4bf73ea06de
packaging: extract virtualenv and py2exe to build directory
The build directory is essentially a cache. We can extract
the virtualenv and py2exe package sources to this directory.
Differential Revision: https://phab.mercurial-scm.org/D6088
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 07 Mar 2019 10:35:20 -0800 |
parents | dc7827a9ba64 |
children | 5e923355c595 |
comparison
equal
deleted
inserted
replaced
41911:dc7827a9ba64 | 41912:d4bf73ea06de |
---|---|
84 | 84 |
85 if not gettext_root.exists(): | 85 if not gettext_root.exists(): |
86 extract_zip_to_directory(gettext_pkg, gettext_root) | 86 extract_zip_to_directory(gettext_pkg, gettext_root) |
87 extract_zip_to_directory(gettext_dep_pkg, gettext_root) | 87 extract_zip_to_directory(gettext_dep_pkg, gettext_root) |
88 | 88 |
89 # This assumes Python 2. We don't need virtualenv on Python 3. | |
90 virtualenv_src_path = build_dir / ( | |
91 'virtualenv-%s' % virtualenv_entry['version']) | |
92 virtualenv_py = virtualenv_src_path / 'virtualenv.py' | |
93 | |
94 if not virtualenv_src_path.exists(): | |
95 extract_tar_to_directory(virtualenv_pkg, build_dir) | |
96 | |
97 py2exe_source_path = build_dir / ('py2exe-%s' % py2exe_entry['version']) | |
98 | |
99 if not py2exe_source_path.exists(): | |
100 extract_zip_to_directory(py2exe_pkg, build_dir) | |
101 | |
89 with tempfile.TemporaryDirectory() as td: | 102 with tempfile.TemporaryDirectory() as td: |
90 td = pathlib.Path(td) | 103 td = pathlib.Path(td) |
91 | |
92 # This assumes Python 2. | |
93 extract_tar_to_directory(virtualenv_pkg, td) | |
94 extract_zip_to_directory(py2exe_pkg, td) | |
95 | |
96 virtualenv_src_path = td / ('virtualenv-%s' % | |
97 virtualenv_entry['version']) | |
98 py2exe_source_path = td / ('py2exe-%s' % | |
99 py2exe_entry['version']) | |
100 | |
101 virtualenv_py = virtualenv_src_path / 'virtualenv.py' | |
102 | 104 |
103 if not venv_path.exists(): | 105 if not venv_path.exists(): |
104 print('creating virtualenv with dependencies') | 106 print('creating virtualenv with dependencies') |
105 subprocess.run( | 107 subprocess.run( |
106 [str(python_exe), str(virtualenv_py), str(venv_path)], | 108 [str(python_exe), str(virtualenv_py), str(venv_path)], |