Re: [Enigmail] moving buildscripts to python3

Patrick Brunschwig <[email protected]> Sat, 9 Nov 2019 19:15:30 +0100
Newsgroups gmane.comp.mozilla.enigmail.general
Message-ID <[email protected]>
Daniel Kahn Gillmor wrote on 09.11.2019 05:54:
> On Fri 2019-11-08 14:04:25 +0100, Patrick Brunschwig wrote:
>> My aim is to require a subset of the tools required by Mozilla to build
>> Thunderbird - the python scripts in Enigmail were all copied from the
>> Mozilla build toolchain, and I never modified any of them. If the
>> Mozilla build tools are migrated to python3, then I'll be happy to copy
>> them over to Enigmail.
> 
> The Mozilla build tools are migrated to python3:
> 
>     https://bugzilla.mozilla.org/show_bug.cgi?id=1388447
> 
> But they have grown and changed quite a bit since you copied them into
> enigmail, it looks like.
> 
>     https://sources.debian.org/src/thunderbird/1:68.2.1-1/python/mozbuild/mozbuild/
> 
> JarMaker.py is now jar.py, etc.
> 
> copying all of that over to enigmail's source tree seems problematic at
> best -- there's no clear maintenance plan, and it's a ton of code.
> 
> It looks like there are three specific commands during the build that
> invoke any of the python code:
> 
>            Makefile:  util/checkFiles.py
>       lang/Makefile:  $(PYTHON) ../util/JarMaker.py -j $(DIST) -t . -f flat $(BUILD)/lang/jar.mn
> ui/content/Makefile:  $(PYTHON) $(DEPTH)/util/Preprocessor.py -I $(INCLUDE) -o $@ $<
> 
> checkFiles.py and Preprocessor.py appear to be relatively
> straightforward to port, just using /usr/bin/2to3-2.7 and doing
> straightforward manual cleanup.
> 
> But JarMaker.py has a handful of weird things that weren't very
> py3-friendly:
> 
>  - use of cmp() (see https://docs.python.org/3.0/whatsnew/3.0.html#ordering-comparisons)
>  
>  - TypeError: '>' not supported between instances of 'time.struct_time'
>   and 'int'  when doing:
> 
>        if (m.group('optOverwrite')
>           or (getModTime(realsrc) >
>               outHelper.getDestModTime(m.group('output')))):
> 
> anyway, i think i've fixed them on my py3 branch on gitlab:
> 
>     https://gitlab.com/dkg/enigmail/commits/py3
> 
> enigmail now builds ok for me on a dedicated machine, but it is a little
> bit strange -- the updated util/Preprocessor.py sometimes leaves a
> zero-byte file, rather than a preprocessed file.  I can't figure out
> what's causing that, though i note that it is more likely if no
> __pycache__ directory is present.
> 
> If i work around that by rebuilding when i observe that the output is
> the empty file, then the built package ends up looking identical to the
> package i built with python2.
> 
> I am afraid i don't understand util/Preprocessor.py well, and it appears
> to only be used directly to strip out some UI for postbox in a single
> file (ui/content/enigmailMessengerOverlay.xul), which doesn't seem like
> a great tradeoff to me -- i'd rather have a sleeker and more robust
> build system if possible.

I agree. I wrote a new plpp.pl file, which just does a simplified
version of C-style CPP, that suits the needs of Enigmail. I'll use that
instead of Preprocessor.py, which does a lot more.

I'm currently merging your changes into the main tree.

-Patrick

_______________________________________________
enigmail-users mailing list
[email protected]
To unsubscribe or make changes to your subscription click here:
https://admin.hostpoint.ch/mailman/listinfo/enigmail-users_enigmail.net
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEET5+J9VBawdGiYGMc2xGHud1faTsFAl3HAkMACgkQ2xGHud1f
aTvZfxAAqDMS8XS7PciDJ6UPGrjkPwuXm3Hy9+7d9C/MtjLY0hSdjOqUMH4SemOj
EUy6GHvULH24OHskmfWbO9EN7MTfrkQGH/G4X4lea46NNABBK/dZoxXITfXo6l/h
G5t0Bvt/C2l0Zz6nIkocGLy4nYopLV9OhLhv07xx4EHQspGR4MUN0pKkSAgVU223
SllHdGW8NWgpPQz8LAx/9HDgQztCKhqpJR7iTi3qwHrvPc9irMl3FkpycXQ80Cen
KzOunfs7+mTpKrgoF4T9x+7d28b9Dqeqe250DzF9yjWU2NvN23/vvxop7h8nJ5ED
LbXeedkG2alp5f89hzp4V04SJ9zPreGNL078C1RS3MCTy+93ufgW+Q2VgPG0BK+Q
7Lp3HbWYbTuQM2QsFP/+t89npWMmqSUJtGnn9Ag9NG9Vdi/pZjKfSZ5EaFG791bJ
xnbeKsrvUUavcvtITchKs+1ee1jwRZEIpmyX/rGyJ2Fnpv80PYGQdeTfQWT+zh/p
ssNPKa4PB5ES8ATQPz7VA8vCerkfHBdZgvBY85tQwRd6VxOQI9az7d1olVVjbcdG
v/coGqAgn0pcbAi7Jmy9tIXk/7tqHtqHrnCWyFr2RZGVUpaNgJNu7guBceA0XOtj
j4FY3KQuTbDYPGlIOntOy2ESUKeo4Jnnxrhod48gteZ6Ft8j5rc=
=tVTA
-----END PGP SIGNATURE-----