Patchwork D9856: packaging: allow specifying modules to include with py2exe

login
register
mail settings
Submitter phabricator
Date Jan. 25, 2021, 1:33 a.m.
Message ID <differential-rev-PHID-DREV-rdcdo7ml5ucslhgkxbhq-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48168/
State Superseded
Headers show

Comments

phabricator - Jan. 25, 2021, 1:33 a.m.
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Maybe this was missing because there wasn't a need for it.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  contrib/packaging/hgpackaging/py2exe.py
  setup.py

CHANGE DETAILS




To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1694,6 +1694,8 @@ 
     'mercurial.pure',
 ]
 
+py2exe_includes = []
+
 py2exeexcludes = []
 py2exedllexcludes = ['crypt32.dll']
 
@@ -1722,6 +1724,10 @@ 
     if extrapackages:
         py2exepackages.extend(extrapackages.split(' '))
 
+    extra_includes = os.environ.get('HG_PY2EXE_EXTRA_INCLUDES')
+    if extra_includes:
+        py2exe_includes.extend(extra_includes.split(' '))
+
     excludes = os.environ.get('HG_PY2EXE_EXTRA_EXCLUDES')
     if excludes:
         py2exeexcludes.extend(excludes.split(' '))
@@ -1821,6 +1827,7 @@ 
         'py2exe': {
             'bundle_files': 3,
             'dll_excludes': py2exedllexcludes,
+            'includes': py2exe_includes,
             'excludes': py2exeexcludes,
             'packages': py2exepackages,
         },
diff --git a/contrib/packaging/hgpackaging/py2exe.py b/contrib/packaging/hgpackaging/py2exe.py
--- a/contrib/packaging/hgpackaging/py2exe.py
+++ b/contrib/packaging/hgpackaging/py2exe.py
@@ -67,6 +67,7 @@ 
     extra_excludes=None,
     extra_dll_excludes=None,
     extra_packages_script=None,
+    extra_includes=None,
 ):
     """Build Mercurial with py2exe.
 
@@ -176,6 +177,8 @@ 
         )
         if hgext3rd_extras:
             env['HG_PY2EXE_EXTRA_INSTALL_PACKAGES'] = ' '.join(hgext3rd_extras)
+    if extra_includes:
+        env['HG_PY2EXE_EXTRA_INCLUDES'] = ' '.join(sorted(extra_includes))
     if extra_excludes:
         env['HG_PY2EXE_EXTRA_EXCLUDES'] = ' '.join(sorted(extra_excludes))
     if extra_dll_excludes: