Hello,
Under Windows, Python 2.4 uses Microsoft Visual Studio .NET 2003 and its new
ABI. All the binary extensions produced for Python 2.4 must use the same ABI
and probably built by the same compiler (or the identical free version
available for download). The PE executables built by VS2003 contain a dummy
section which is used to record something related to SEH (structured
exception handling). The details are hairy and undisclosed by Microsoft, but
the net result is that you need to tell UPX to strip that section while
compressing, or it will refuse to do it.
There is an option to do that: --strip-loadconf. It's pretty safe. I have
been discussing and investigating the issue with the UPX developers, and we
have not been able to find out what that dozen bytes of data are used for.
Even programs which explicitally use SEH work fine when the section is
stripped.
This patch makes Build.py pass --strip-loadconf by default to UPX when used
under Windows and Python 2.4. It also adds --best to UPX by default as it
makes sense to use the best compression if UPX is available.
Committed as r251. I really wanted this in PyInstaller 1.1 and I had
forgotten about it. So I'm tagging this as RC2.
--
Giovanni Bajo
Index: Build.py
===================================================================
--- Build.py (revision 250)
+++ Build.py (revision 251)
@@ -42,6 +42,19 @@
if config['hasRsrcUpdate']:
import icon, versionInfo
+def setupUPXFlags():
+ f = os.environ.get("UPX", "")
+ is24 = hasattr(sys, "version_info") and sys.version_info[:2] >= (2,4)
+ if iswin and is24:
+ # Binaries built with Visual Studio 7.1 require --strip-loadconf
+ # or they won't compress.
+ f = "--strip-loadconf " + f
+ f = "--best " + f
+ os.environ["UPX"] = f
+
+if config['hasUPX']:
+ setupUPXFlags()
+
def build(spec):
global SPECPATH, BUILDPATH, WARNFILE, rthooks
rthooks = eval(open(os.path.join(HOMEPATH, 'rthooks.dat'), 'r').read())
Index: doc/CHANGES.txt
===================================================================
--- doc/CHANGES.txt (revision 250)
+++ doc/CHANGES.txt (revision 251)
@@ -22,6 +22,9 @@
single-file executables, even when using the newest Python version!
+ (Linux) Ignore linux-gate.so while calculating dependencies (fix provided
by Vikram Aggarwal).
+ + (Windows) With Python 2.4, setup UPX properly so to be able to compress
+ binaries generated with Visual Studio .NET 2003 (such as most of the
+ extensions).
PyInstaller 1.0 (with respect to McMillan's Python Installer 5b5):
_______________________________________________
PyInstaller mailing list
[email protected]
http://lists.hpcf.upr.edu/mailman/listinfo/pyinstaller