D6088: packaging: extract virtualenv and py2exe to build directory

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Thu Mar 7 19:50:11 EST 2019


indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The build directory is essentially a cache. We can extract
  the virtualenv and py2exe package sources to this directory.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6088

AFFECTED FILES
  contrib/packaging/hgpackaging/inno.py

CHANGE DETAILS

diff --git a/contrib/packaging/hgpackaging/inno.py b/contrib/packaging/hgpackaging/inno.py
--- a/contrib/packaging/hgpackaging/inno.py
+++ b/contrib/packaging/hgpackaging/inno.py
@@ -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(



To: indygreg, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list