For assistance of anyone wanting to use multipackage support, here's my
experience:
I have an application that involves several executables, some Python,
some "other". The build process results in a folder called Programs,
initially containing just the other executables. My intent was to have
a spec file that, for each Python executable, creates a folder in
Programs named for the executable, and containing the executable and its
unique dependencies. Also, I wanted a shortcut in Programs that would
invoke the executable, running in its folder.
Finally, I created a little dummy Python program, whose folder is
intended to accumulate the common dependencies among the real executables.
I've been able to accomplish that using the MERGE function, with the
dummy Analysis object first in the list.
Martin Zibricky writes:
If you have any suggestions for improving the documentation about
multipackage feature, we would welcome bug reports.
Here's a proposed rewrite of the Multipackage Function section of the
manual:
------------------------------------------------------------------------
With Pyinstaller you can create a collection of packages to avoid
library duplication. You can establish links between packages using the
function MERGE in your spec file.
For example, you might wish to deploy your application with an updater
utility and a configurator, both sharing libraries with main
application. In such a case you could use MERGE function in order to
create a main, big, package, with all libraries and dependencies inside,
and two small packages next to the first one. In this case, you'd pass
a list of three tuples to MERGE: the first one for the main application,
and two for the updater and duplicator; the result will be three package
directories.
Note that all common dependency files will be created in the first
package, and referenced there by the other executables. For this
reason, all packages linked this way must be placed in the same parent
directory, and changing directory structure after the merge will result
in failure of the executables.
There are multipackage examples in the 'buildtests' dir.
------------------------------------------------------------------------
For what it may be worth to others, here's the core of the spec file:
## Where the package folders will be built, and the shortcuts will reside
TargetDir = os.path.abspath(os.path.join('..','..','Client','Programs'))
## The application names
AppNames = [d for d in os.listdir(os.getcwd())
if os.path.isdir(d)
and d[0]!='.'
and d[0:6]!='Common'
and d != 'build'
and d != 'dummy']
## Build MERGE arguments (analysis object, script base name, final exe
path)
# Start with the dummy package
Analyses = [(Analysis([os.path.join(HOMEPATH,'support', '_mountzlib.py'),
os.path.join(HOMEPATH,'support', 'useUnicode.py'),
os.path.join('dummy','dummy.py')]),
'dummy', os.path.join('dummy','dummy.exe'))
]
# NOTE: this assumes that the main script in each is appname.pyw in
the appname folder
Analyses += [(Analysis([os.path.join(HOMEPATH,'support', '_mountzlib.py'),
os.path.join(HOMEPATH,'support', 'useUnicode.py'),
os.path.join(appname, appname + '.pyw')]),
appname, os.path.join(appname,appname+'.exe'))
for appname in AppNames]
## Merge all the dependencies
MERGE(*Analyses)
## Build each app
for anal, basename, exename in Analyses:
pyz = PYZ(anal.pure)
exe = EXE(pyz,
anal.scripts,
anal.dependencies,
exclude_binaries=1,
name=exename,
version='FalconVersion.txt',
debug=False,
strip=False,
upx=True,
console=False )
dist = COLLECT(exe,
anal.binaries,
anal.zipfiles,
anal.datas,
strip=False,
###upx=True if (basename == 'dummy') else False,
upx=False,
name=os.path.join(TargetDir,basename))
--
Don Dwiggins
Advanced Publishing Technology
--
You received this message because you are subscribed to the Google Groups
"PyInstaller" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pyinstaller?hl=en.