# HG changeset patch # User Gregory Szorc # Date 2019-03-03 23:46:26 # Node ID ed35057421ae3a21b727fbfa943cae45f009498c # Parent d80d48928eb115337dea1b19cb10bf9864749f22 setup: include additional packages in py2exe distribution I'm attempting to reproduce the Inno installers on my local machine. As part of auditing differences between installer output, I noticed that the existing Inno installers include various 3rd party packages. There is no mention of this in the build instructions nor on the wiki. This must be something that is done by the installer producer. This commit teaches setup.py to include these 3rd party packages in py2exe's library. After this change, I am able to produce Inno installers that have a nearly identical set of Python modules. It's worth noting that pywin32 is included even though it probably shouldn't be. But including it is necessary in order to achieve parity with existing Inno installers. Differential Revision: https://phab.mercurial-scm.org/D6064 diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -1240,8 +1240,20 @@ setupversion = version.decode('ascii') extra = {} +py2exepackages = [ + 'hgdemandimport', + 'hgext', + 'email', + # implicitly imported per module policy + # (cffi wouldn't be used as a frozen exe) + 'mercurial.cext', + #'mercurial.cffi', + 'mercurial.pure', +] + if issetuptools: extra['python_requires'] = supportedpy + if py2exeloaded: extra['console'] = [ {'script':'hg', @@ -1252,6 +1264,34 @@ if py2exeloaded: # put dlls in sub directory so that they won't pollute PATH extra['zipfile'] = 'lib/library.zip' + try: + import dulwich + dulwich.__version__ + py2exepackages.append('dulwich') + except ImportError: + pass + + try: + import keyring + keyring.util + py2exepackages.append('keyring') + except ImportError: + pass + + try: + import pygments + pygments.__version__ + py2exepackages.append('pygments') + except ImportError: + pass + + try: + import pywintypes + pywintypes.TRUE + py2exepackages.append('pywintypes') + except ImportError: + pass + if os.name == 'nt': # Windows binary file versions for exe/dll files must have the # form W.X.Y.Z, where W,X,Y,Z are numbers in the range 0..65535 @@ -1331,16 +1371,7 @@ setup(name='mercurial', distclass=hgdist, options={ 'py2exe': { - 'packages': [ - 'hgdemandimport', - 'hgext', - 'email', - # implicitly imported per module policy - # (cffi wouldn't be used as a frozen exe) - 'mercurial.cext', - #'mercurial.cffi', - 'mercurial.pure', - ], + 'packages': py2exepackages, }, 'bdist_mpkg': { 'zipdist': False,