Mercurial > hg-stable
changeset 41917: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 |
files | contrib/packaging/hgpackaging/inno.py |
diffstat | 1 files changed, 13 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/packaging/hgpackaging/inno.py Thu Mar 07 15:43:14 2019 -0800 +++ b/contrib/packaging/hgpackaging/inno.py Thu Mar 07 10:35:20 2019 -0800 @@ -86,20 +86,22 @@ extract_zip_to_directory(gettext_pkg, gettext_root) extract_zip_to_directory(gettext_dep_pkg, gettext_root) + # This assumes Python 2. We don't need virtualenv on Python 3. + virtualenv_src_path = build_dir / ( + 'virtualenv-%s' % virtualenv_entry['version']) + virtualenv_py = virtualenv_src_path / 'virtualenv.py' + + if not virtualenv_src_path.exists(): + extract_tar_to_directory(virtualenv_pkg, build_dir) + + py2exe_source_path = build_dir / ('py2exe-%s' % py2exe_entry['version']) + + if not py2exe_source_path.exists(): + extract_zip_to_directory(py2exe_pkg, build_dir) + with tempfile.TemporaryDirectory() as td: td = pathlib.Path(td) - # This assumes Python 2. - extract_tar_to_directory(virtualenv_pkg, td) - extract_zip_to_directory(py2exe_pkg, td) - - virtualenv_src_path = td / ('virtualenv-%s' % - virtualenv_entry['version']) - py2exe_source_path = td / ('py2exe-%s' % - py2exe_entry['version']) - - virtualenv_py = virtualenv_src_path / 'virtualenv.py' - if not venv_path.exists(): print('creating virtualenv with dependencies') subprocess.run(