I was editing the spec files by hand for smaller stuff that seemed far too
similar and decided to just make a short script to generate everything
needed by passing the python script name as an argument.

Usage: python binarybuilder.py <your_python_script_name>

Change it as you want, just thought someone out there might find it useful.


import os
> import sys
>
> filename = sys.argv[1]
> pyinstallerpath = 'c:\\pyinstaller\\'
> iconfile = 'c:\\icons\\file.ico'
>
> ## Generate the spec file
>
> output = open("%s.spec" % filename, 'w')
> output.write("a =
> Analysis([os.path.join(HOMEPATH,'support\\_mountzlib.py'), \
> os.path.join(HOMEPATH,'support\\unpackTK.py'),
> os.path.join(HOMEPATH,'support\\useTK.py'), \
> os.path.join(HOMEPATH,'support\\useUnicode.py'), 'c:\\%s.py',
> os.path.join(HOMEPATH,'support\\removeTK.py')],\
>              pathex=['c:\\:c:\\Python25', 'c:\\'])\
> pyz = PYZ(a.pure)\
> exe = EXE(TkPKG(), pyz,\
>           a.scripts,\
>           a.binaries,\
>           name='%s.exe',\
>           debug=False,\
>           strip=False,\
>           upx=True,\
>           console=False , icon='%s'" % (filename, filename, iconfile))
> output.close()
>
> ## Run pyinstaller
>
> p = os.popen4(r'cmd /k')
> p[0].write('c:\python25\python.exe %sMakespec.py --noconsole --onefile
> --icon=%s --upx --tk c:\%s.py --paths=c:\:c:\Python25\r\n' %
> (pyinstallerpath, iconfile, filename))
> p[0].flush()
> p[0].write('c:\python25\python.exe %sBuild.py %s.spec\r\n' %
> (pyinstallerpath, filename))
> p[0].flush()
> p[0].write('exit\r\n')
> p[0].flush()
> print ''.join(p[1].readlines())
>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To post to this group, send email to PyInstaller@googlegroups.com
To unsubscribe from this group, send email to 
pyinstaller+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/PyInstaller?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to