Am 01.02.2013 21:08, schrieb Daniel Casper:
> I'm hoping someone can provide me with some more advanced examples or
> assistance regarding the use of PyInstaller's PYZ Archives and
> approaches for reducing redundancy in minimal deployments.  I started
> with the following simplistic .spec file for onefile:

Now, this is a tricky one. It took me 2 hours to solve it.

This is what you need:
1) A combined PYZ (as you have)
2) An additional boot-script to add the PYZ to sys.path (including some
deep PyInstaller magic)
3) A minimal PYZ to be included in each EXE containing the requirements
of the boot-scripts.

And this is the code:

....8<-------- test.spec -----
a = Analysis(['test.py'])
b = Analysis(['spam.py'])
pyz = PYZ(a.pure + b.pure)

boot = Analysis(['__boot.py'])
boot_pyz = PYZ(boot.pure)

exe_a = EXE(boot_pyz, boot.scripts, a.scripts,
          exclude_binaries=1,
          name=os.path.join('build/pyi.linux2/test', 'test'))
exe_b = EXE(b.scripts,
          exclude_binaries=1,
          name=os.path.join('build/pyi.linux2/test', 'spam'))
coll = COLLECT(
               exe_a, a.binaries, a.zipfiles, a.datas,
               exe_b, b.binaries, b.zipfiles, b.datas,
               TOC([('library.pyz', pyz.name, 'DATA')]),  # adding pyz
does not work
               strip=None,
               upx=True,
               name=os.path.join('dist', 'test'))
....8<--------

....8<-------- __boot.py -----
import sys
import pyi_importers
sys.path.append('library.pyz') # you should base it on sys._MEIPASS
pyi_importers.install()
....8<--------------

Please lat my know whether this works for you.

-- 
Schönen Gruß
Hartmut Goebel
Dipl.-Informatiker (univ), CISSP, CSSLP

Goebel Consult
http://www.goebel-consult.de

Monatliche Kolumne:
http://www.cissp-gefluester.de/2012-09-steht-ein-manta-fahrer-vor-der-uni
Blog: http://www.goebel-consult.de/blog/20060215

Goebel Consult ist Mitglied bei http://www.7-it.de/

Attachment: smime.p7s
Description: S/MIME Kryptografische Unterschrift

Reply via email to