Franck Pommereau

support pyinstaller

......@@ -3,3 +3,5 @@ syntax: glob
*.pyc
*~
,*
dist/
build/
......
standalone:
rm -rf build dist
pyinstaller --clean -F -w bones.py bones_edit.py bones_machine.py
pyinstaller --clean -F -w bones_edit.py bones_machine.py
pyinstaller --clean -F -w bones_machine.py
@pythonw -x "%~f0" %* & exit /b
import sys
import bones.cmd
bones.cmd.launch("bones_edit.py", *sys.argv[1:]).wait()
\ No newline at end of file
# -*- mode: python -*-
a = Analysis(['bones.py', 'bones_edit.py', 'bones_machine.py'],
pathex=['/home/franck/work/cours/archi/bones'],
hiddenimports=[],
hookspath=None,
runtime_hooks=None)
pyz = PYZ(a.pure)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='bones',
debug=False,
strip=None,
upx=True,
console=False )
import subprocess, sys, inspect, os.path
import subprocess, sys, os.path
def launch (script, *args) :
print " ".join([sys.executable, find(script)] + list(args))
return subprocess.Popen([sys.executable, find(script)] + list(args))
def find (script) :
root = os.path.dirname(os.path.dirname(inspect.getsourcefile(find)))
old = None
while root != old :
path = os.path.join(root, script)
if os.path.isfile(path) :
return path
old, root = root, os.path.dirname(root)
raise IOError("script not found %r" % script)
base, ext = os.path.splitext(os.path.basename(sys.executable))
script, _ = os.path.splitext(script)
if base.lower() == "python" :
script = os.path.join(os.path.dirname(sys.argv[0]), script + ".py")
cmd = [sys.executable, script]
elif ext.lower() in (".exe", ".app", "") :
cmd = [os.path.join(os.path.dirname(sys.executable), script + ext)]
else :
raise IOError("could not find how to launch %r" % script)
cmd.extend(args)
print " ".join(cmd)
return subprocess.Popen(cmd)
......
# -*- mode: python -*-
a = Analysis(['bones_edit.py', 'bones_machine.py'],
pathex=['/home/franck/work/cours/archi/bones'],
hiddenimports=[],
hookspath=None,
runtime_hooks=None)
pyz = PYZ(a.pure)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='bones_edit',
debug=False,
strip=None,
upx=True,
console=False )
# -*- mode: python -*-
a = Analysis(['bones_machine.py'],
pathex=['/home/franck/work/cours/archi/bones'],
hiddenimports=[],
hookspath=None,
runtime_hooks=None)
pyz = PYZ(a.pure)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='bones_machine',
debug=False,
strip=None,
upx=True,
console=False )