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
--- 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,
},