Well I got it sort of working, but it is kinda hacked together:
# -*- mode: python -*-
a = Analysis(
[os.path.join(HOMEPATH, 'support', '_mountzlib.py'),
os.path.join(HOMEPATH, 'support', 'useUnicode.py'), '..\
\CouchPotato.py'],
pathex = ['Y:\\Localhost\\Python\\CouchPotato\\pyInstaller', '..\
\library'],
)
ex = ['CouchPotato', 'library', 'cherrypy', 'app', 'markupsafe',
'sqlalchemy', 'routes', 'minify', 'imdb', 'routes', 'mako', 'win32',
'pywin', 'dateutil']
importList = ''
for item in a.pure:
include = True
for exclude in ex:
if item[0].lower().startswith(exclude):
include = False
if include:
importList += 'import ' + item[0] + '\n'
handle = open('..//build/Windows.py', 'w')
handle.write(importList)
handle.close()
a = Analysis(
[os.path.join(HOMEPATH, 'support', '_mountzlib.py'),
os.path.join(HOMEPATH, 'support', 'useUnicode.py'), '..\
\WindowsStart.py', '..\\build\\Windows.py'],
pathex = ['Y:\\Localhost\\Python\\CouchPotato\\pyInstaller'],
excludes = ex
)
pyz = PYZ(a.pure)
exe = EXE(pyz,
a.scripts,
a.binaries,
name = 'CouchPotato.exe',
debug = False,
strip = False,
upx = False,
console = True,
icon = '..\\media\\images\\favicon.ico',
)
col = COLLECT(exe,
[('logging.conf', '..\\logging.conf', 'DATA')],
[('README.md', '..\\README.md', 'DATA')],
[('CouchPotato.py', '..\\CouchPotato.py', 'PYSOURCE')],
name = os.path.join('build', 'CouchPotato')
)
COLLECT(library, name = os.path.join('build', 'CouchPotato',
'library'))
COLLECT(cherrypy, name = os.path.join('build', 'CouchPotato',
'cherrypy'))
COLLECT(app, name = os.path.join('build', 'CouchPotato', 'app'))
COLLECT(media, name = os.path.join('build', 'CouchPotato', 'media'))
What it does it:
Scans all my python files for which modules to include.
Removes all the modules I want to include as source later.
Analyse again, using WindowsStart.py that calls my main script
(CouchPotato.py), excluding all the modules I want to exclude from the
a.scripts.
Collect the exe + some files
Collect the modules
The problem is that if I exclude modules from scan, it also doesn't
add the modules that module is using.
For example if I exlude sqlalchemy, the module pysqlite3 isnt included
and thus the program won't run.
Hopes this makes sense.
--
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.