fabmodules/src/apps/bundle.py

62 wiersze
1.5 KiB
Python
Executable File

#!/usr/bin/env python
"""
This is a setup.py script generated by py2applet
Usage:
python setup.py py2app
"""
from setuptools import setup
import shutil
import os
import stat
import subprocess
import glob
# Trick to make this run properly
import sys
sys.argv += ['py2app']
subprocess.call(['make','fab'], cwd='../..')
# Delete old build stuff
try: shutil.rmtree('build')
except OSError: pass
try: shutil.rmtree('koko')
except OSError: pass
try: os.remove('kokopelli.py')
except OSError: pass
# This is the pythons script that we're bundling into an application.
shutil.copy('../../bin/kokopelli','kokopelli.py')
shutil.copytree('../../bin/koko','koko')
APP = ['kokopelli.py']
DATA_FILES = glob.glob('../bin/koko/lib/*.py') + ['cba_icon.png']
OPTIONS = {'argv_emulation': True,
'iconfile':'cba.icns'}
# Run py2app to bundle everything.
setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
# Copy libtree
os.mkdir('dist/kokopelli.app/Contents/lib')
shutil.copy('../../lib/libfab.dylib',
'dist/kokopelli.app/Contents/lib/libfab.dylib')
# Copy the readme and examples into the distribution directory, then zip it up
shutil.copy('README','dist')
shutil.copy('../../../../Web/examples.zip', 'dist/examples.zip')
os.system('cd dist; unzip examples.zip; rm -rf __MACOSX;'+
'zip -r kokopelli.zip kokopelli.app README examples')
shutil.rmtree('build')
shutil.rmtree('koko')
shutil.os.remove('kokopelli.py')