[tor-dev] Deployability of Python software.

Bernd prof7bit at googlemail.com
Tue Mar 6 18:24:37 UTC 2012

2012/3/2 Arturo Filastò <hellais at torproject.org>:

> - How do we get a good Windows binary of the Software?
> - How do we keep the size down to an acceptable level?
> - What kind of performance drawbacks would we be experiencing?

I have used pyinstaller for the Windows builds of TorChat.
my build script (its in the src directory) will first apply
pyinstaller to pack all required and imported python files along with
the python interpreter (python2.x.dll), the wxPython GUI toolkit along
with all needed dlls into one single executable .exe file, then
applies upx to it and finally bundles it all together with a copy of
tor.exe into a zip file of only 7MB.

There are no performance-drawbacks compared to running it the "normal"
way, the only confusing thing with pyinstaller is there will be two
processes running, one very small bootstrapper that will unpack before
running and clean-up afterwards and the actual application itself and
both have the same name. This is not a problem, only confusing.
Pyinstaller will temporarily unpack everything into a temp directory
and run it from there, so if it crashes it will leave files behind.

The other alternative is py2exe, this will do it all in memory without
temp files, produces similarly small exe files but older versions had
problems with properly bundling the msvc runtime dlls along with their
manifest files, pyinstaller solved this for me so I switched to
pyinstaller. If you checkout very early revisions of TorChat you will
find the old versions built with py2exe.

On Linux I let it run with the installed version of python (see my
.deb build script, also in the src folder, and also the starter script
that will try to find the newest installed 2.x version), there was a
time when this produced some difficulty with a wide range of available
python (and wx) versions and my limited resources to test them all,
but this is now consolidating towards 2.7 available everywhere and
these problems are gone. For the same reason you should not (not yet)
chose Python 3.x because then you will find yourself in the multiple
version hell soon again. Never use bleeding edge dependencies and
anything that is not found on debian stale has to be considered
bleeding edge. I'm using Windows XP to build the windows version.


More information about the tor-dev mailing list