Module to distribute the application with distutils
For running Pyinstaller, use: # From Pytomo sources directory find . -name ‘*.pyc’ -delete rm -r build
Example using Pytomo-1.9.6 source distribution
> python C:Python27pyinstaller-1.5.1Makespec.py –onefile -p Pytomo-1.9.6-p Pytomo-1.9.6pytomo -o Pytomo-1.9.6 Pytomo-1.9.6inpytomo * modify by hand Pytomo-1.9.6pytomo.spec to make sure the .exe is created directly in the root directory (due to distutils problems with including data files); it should look something like: > type Pytomo-1.9.6pytomo.spec # -- mode: python -- from platform import system, machine a = Analysis([os.path.join(HOMEPATH,’support_mountzlib.py’), os.path.join(HOMEPATH,’supportuseUnicode.py’), ‘Pytomo-1.9.6binpytomo’],
pathex=[‘Pytomo-1.9.6’, ‘Pytomo-1.9.6pytomo’, ‘C:Documents and Settingsrqpj0589Desktop’])
pyz = PYZ(a.pure) exe = EXE( pyz,
a.scripts, a.binaries, a.zipfiles, a.datas, name=’‘.join((‘_’.join((‘pytomo’, system().lower(), machine())),
‘.exe’)),
#name=os.path.join(‘dist’, ‘pytomo.exe’), debug=False, strip=False, upx=True, console=True )’])
> python C:Python27pyinstaller-1.5.1Build.py Pytomo-1.9.6pytomo.spec
> python C:Python27pyinstaller-1.5.1Makespec.py –onefile -p Pytomo-1.9.6-p Pytomo-1.9.6pytomo -o Pytomo-1.9.6 Pytomo-1.9.6inpytomo_web_interface * modify by hand Pytomo-1.9.6pytomo.spec to make sure the .exe is created directly in the root directory (due to distutils problems with including data files); it should look something like: > type Pytomo-1.9.6pytomo_web_interface.spec # -- mode: python -- from platform import system, machine a = Analysis([os.path.join(HOMEPATH,’support_mountzlib.py’), os.path.join(HOMEPATH,’supportuseUnicode.py’), ‘Pytomo-1.9.6binpytomo_web_interface’],
pathex=[‘Pytomo-1.9.6’, ‘Pytomo-1.9.6pytomo’, ‘C:Documents and Settingsrqpj0589Desktop’])’])
pyz = PYZ(a.pure) exe = EXE( pyz,
a.scripts, a.binaries, a.zipfiles, a.datas, name=’‘.join((‘_’.join((‘pytomo_web_interface’,system().lower(),
machine())), ‘.exe’)),
#name=os.path.join(‘dist’, ‘pytomo.exe’), debug=False, strip=False, upx=True, console=True )’])
- to create the executable pytomo_windows_x86.exe:
> python C:Python27pyinstaller-1.5.1Build.py Pytomo-1.9.6pytomo_web_interface.spec
> cd Pytomo-1.9.6 Pytomo-1.9.6> python setup_windows.py sdist -t MANIFEST_windows.in
# for MAC: import sys if sys.platform.startswith(“darwin”):
- app = BUNDLE(exe,
- name=os.path.join(‘dist’, ‘NAME.app’), version=version)