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:

# -*- mode: python -*-
a = Analysis(['j:\\rpmv\\RPM UI - V2\\src\\bootstrap.py'],
             pathex=['j:\\git\\pyinstaller'],
             hiddenimports=[],
             hookspath=None,
             runtime_hooks=None)
pyz = PYZ(a.pure)
exe = EXE(pyz,
          a.scripts,
          a.binaries,
          a.zipfiles,
          a.datas - [('.\\pywintypes27.dll', '', '')],
          name=os.path.join('dist', 'rpmgui.exe'),
          debug=False,
          strip=None,
          upx=True,
          console=False , icon='j:\\rpmv\\rpm UI - 
v2\\src\\icons\\rpm-32.ico')

app = BUNDLE(exe,
             name=os.path.join('dist', 'rpmgui.exe.app'))

And that seems to work, but single-file is less than optimal for my 
scenario - I've got 7 or 8 scripts that share resources, so I started 
working on a combined .spec file.  It contains several Analyses, then I 
create a combined PYZ for all of them: 

# Create a common zip file.
Archive = PYZ(UIW.pure + LPR.pure + RAW.pure + EML.pure + DBM.pure + 
PDF.pure,
              'common.bin')
          
# Attempt to create our first output file.
UIW_EX = EXE(UIW.pure - Archive.toc,
             UIW.scripts,
             UIW.binaries,
             name = 'rpmgui.exe',
             console = True)

output = COLLECT(UIW_EX,
                 Archive,
                 name = 'dist-combo')

And that produces an output directory for me that contains this:

02/01/2013  01:03 PM    <DIR>          .
02/01/2013  01:03 PM    <DIR>          ..
02/01/2013  11:23 AM         3,638,842 common.bin
01/29/2013  01:36 PM            11,829 pyi_archive
01/29/2013  01:36 PM             7,322 pyi_importers
01/29/2013  01:36 PM             2,254 pyi_os_path
02/01/2013  01:03 PM           193,461 rpmgui.exe
02/01/2013  01:03 PM               967 rpmgui.exe.manifest
11/05/2012  07:56 AM               234 struct
               7 File(s)      3,854,909 bytes
               2 Dir(s)  327,856,742,400 bytes free

So I feel like I'm getting close to what I want, but my output directory 
doesn't contain python27.dll and I was wondering if there was any example 
code for the "top level code" that would allow these programs to load 
directly from the PYZ.  Is that something as simple as this:

sys.path.append(<path to zip file>)

Or is there something else I need to do to massage my apps into finding 
their modules in this zip file?  Ideally, I'm trying to get to a point 
where I deploy as few files as possible (the PYZ, python27.dll, and the 
.exe files is all I'd like, but I'll take other files if absolutely 
necessary) and get things running so that it doesn't have to extract the 
contents of the PYZ.  Some of the programs are launched repeatedly in rapid 
succession - the extra disk overhead of extracting, reading, operating, and 
cleanup is degrading performance for us.

Thanks in advance for any suggestions.  Please let me know if I can provide 
more information.

--Daniel

-- 
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to