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