Building Py2Exe from source

Kylotan kylotan at hotmail.com
Tue Dec 30 23:32:56 EST 2003


Thomas Heller <theller at python.net> wrote in message news:<oetrl17w.fsf at python.net>...
> kylotan at hotmail.com (Kylotan) writes:
> 
> > I need to be able to build Py2Exe from the source code as I am making
> > a Windows executable where I wish to preprocess the modules before
> > importing them.
> 
> Hm, is this really a good idea?  py2exe includes the .pyc (or .pyo)
> files, not the sources itself.  Can't you preprocess them while building
> the exe?  This way you would only have to hack python-code, not C code...

One of my requirements is encryption of the pyc files. (I need -some-
degree of basic protection against decompyle and the like.) The file
in the archive needs to be encrypted and only decrypted when it comes
to be imported. This looks like only being about 3 or 4 lines of extra
C code (given a standalone encryption library) if put in the correct
place.

> You *should* be able to hack the py2exe setup-script to do this, only
> removing run_svc from the list is certainly not enough.

Sadly Python is my 2nd language, and these distutils scripts in
general are possibly the most complex (or at least idiosyncratic) code
that I've seen. I understand very little of it. :)  And wouldn't know
where to start altering it.

> Normally I would recommend the upcoming py2exe 0.5 for this, although it
> does not yet run on Win98, but I'm working on it.

Ok. I don't need to do this urgently, but Win98SE is going to be both
a key development and deployment platform for me.

-- 
Ben Sizer




More information about the Python-list mailing list