changeset 46350:d6cfe45afb18 stable

packaging: allow specifying modules to include with py2exe Maybe this was missing because there wasn't a need for it. Differential Revision: https://phab.mercurial-scm.org/D9856
author Matt Harbison <matt_harbison@yahoo.com>
date Sun, 24 Jan 2021 19:08:47 -0500
parents a6c5ec6b4728
children 5b747aa1b2be
files contrib/packaging/hgpackaging/py2exe.py setup.py
diffstat 2 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/packaging/hgpackaging/py2exe.py	Sun Jan 24 18:24:11 2021 -0800
+++ b/contrib/packaging/hgpackaging/py2exe.py	Sun Jan 24 19:08:47 2021 -0500
@@ -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:
--- a/setup.py	Sun Jan 24 18:24:11 2021 -0800
+++ b/setup.py	Sun Jan 24 19:08:47 2021 -0500
@@ -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,
         },