[Request] [+- ] D8472: packaging: split Inno installer building from Mercurial building

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Wed Apr 22 02:39:35 UTC 2020


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

REVISION SUMMARY
  We want to make the logic for producing the installer agnostic about
  how Mercurial is built to allow for alternate build methods (like
  PyOxidizer).

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

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
@@ -61,8 +61,7 @@
 
     vc_x64 = r'\x64' in os.environ.get('LIB', '')
     arch = 'x64' if vc_x64 else 'x86'
-    inno_source_dir = source_dir / 'contrib' / 'packaging' / 'inno'
-    inno_build_dir = build_dir / ('inno-%s' % arch)
+    inno_build_dir = build_dir / ('inno-py2exe-%s' % arch)
     staging_dir = inno_build_dir / 'stage'
 
     requirements_txt = (
@@ -104,6 +103,31 @@
         print('copying %s to %s' % (f, dest_path))
         shutil.copyfile(f, dest_path)
 
+    build_installer(
+        source_dir,
+        inno_build_dir,
+        staging_dir,
+        iscc_exe,
+        version,
+        arch="x64" if vc_x64 else None,
+    )
+
+
+def build_installer(
+    source_dir: pathlib.Path,
+    inno_build_dir: pathlib.Path,
+    staging_dir: pathlib.Path,
+    iscc_exe: pathlib.Path,
+    version,
+    arch=None,
+):
+    """Build an Inno installer from staged Mercurial files.
+
+    This function is agnostic about how to build Mercurial. It just
+    cares that Mercurial files are in ``staging_dir``.
+    """
+    inno_source_dir = source_dir / "contrib" / "packaging" / "inno"
+
     # The final package layout is simply a mirror of the staging directory.
     package_files = []
     for root, dirs, files in os.walk(staging_dir):
@@ -158,8 +182,8 @@
 
     args = [str(iscc_exe)]
 
-    if vc_x64:
-        args.append('/dARCH=x64')
+    if arch:
+        args.append('/dARCH=%s' % arch)
 
     if not version:
         version = read_version_py(source_dir)



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20200422/e5e9191d/attachment-0001.html>


More information about the Mercurial-patches mailing list