[PATCH 2 of 2 STABLE] setup: forcibly include cext/pure packages in py2exe (issue5625)

Matt Harbison mharbison72 at gmail.com
Thu Jul 20 22:16:16 EDT 2017


On Thu, 20 Jul 2017 10:39:53 -0400, Yuya Nishihara <yuya at tcha.org> wrote:

> # HG changeset patch
> # User Yuya Nishihara <yuya at tcha.org>
> # Date 1500558460 -32400
> #      Thu Jul 20 22:47:40 2017 +0900
> # Branch stable
> # Node ID d5bb7d09db154036eaf1173c5445356218b8291e
> # Parent  3f8f39ef616024ac0722c701aeae9105a52728fa
> setup: forcibly include cext/pure packages in py2exe (issue5625)
>
> Since these modules are implicitly imported by policy.importmod(), py2exe
> can't track them statically. cffi modules are excluded for now because  
> they
> wouldn't be useful in frozen (i.e. CPython) environment.
>
> diff --git a/setup.py b/setup.py
> --- a/setup.py
> +++ b/setup.py
> @@ -889,7 +889,12 @@ setup(name='mercurial',
>        package_data=packagedata,
>        cmdclass=cmdclass,
>        distclass=hgdist,
> -      options={'py2exe': {'packages': ['hgdemandimport', 'hgext',  
> 'email']},
> +      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']},
>                 'bdist_mpkg': {'zipdist': False,
>                                'license': 'COPYING',
>                                'readme': 'contrib/macosx/Readme.html',

For reasons that baffle me, this allows the Wix installer to get further  
than without this change, but it still fails on the linker.  I ran the  
failing command manually, and it says parsers and diffhelpers are still  
missing:

C:\Users\Matt\Projects\thg-build\winbuild\build>"C:\Program Files  
(x86)\WiX Toolset v3.10\bin\light.exe" -nologo -ext WixUIExtension -sw1076  
-spdb -o ..\..\output\mercurial-stable-4.3.103-x64.msi hg\help.wixobj  
hg\templates.wixobj hg\locale.wixobj hg\doc.wixobj hg\contrib.wixobj  
hg\dist.wixobj hg\mercurial.wixobj hg\i18n.wixobj
c:\Users\Matt\projects\thg-build\winbuild\build\hg\contrib\wix\dist.wxs(17)  
: error LGHT0103 : The system cannot find the file  
'..\hg\dist/lib\mercurial.cext.diffhelpers.pyd'.
c:\Users\Matt\projects\thg-build\winbuild\build\hg\contrib\wix\dist.wxs(20)  
: error LGHT0103 : The system cannot find the file  
'..\hg\dist/lib\mercurial.cext.parsers.pyd'.

Indeed, these two files aren't listed in the '*** copy extensions ***'  
phase of the build.  (So I have no idea why it works for Inno.)  But  
adding this to the py2exe dict allows the MSI to be built:

     'includes': ['mercurial.cext.diffhelpers', 'mercurial.cext.parsers']

Once installed, a side by side compare to 4.2.2 shows the renamed cext  
files as the only orphans, so I think everything else is accounted for in  
the Wix installer.


More information about the Mercurial-devel mailing list