1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
# -*- coding: iso-8859-1 -*-
"""
Build a standalone application for Mac OS X and MS Windows platforms
Usage (Mac OS X):
python setup.py py2app
Usage (Windows):
python setup.py py2exe
"""
import sys
from setuptools import setup
info_plist_template = u"""<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>Ginga</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleGetInfoString</key>
<string>Copyright 2010-2016, Eric Jeschke (eric@naoj.org)</string>
<key>CFBundleIconFile</key>
<string>Ginga.icns</string>
<!-- Version number - appears in About box -->
<key>CFBundleShortVersionString</key>
<string>%(version)s</string>
<!-- Build number - appears in About box -->
<key>CFBundleVersion</key>
<string>%(build)s</string>
<!-- Copyright notice - apears in About box -->
<key>NSHumanReadableCopyright</key>
<string>Copyright 2010-2016, Eric Jeschke (eric@naoj.org)</string>
<!-- Globally unique identifier -->
<key>CFBundleIdentifier</key>
<string>org.naoj.Ginga</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>Ginga</string>
<key>CFBundleDisplayName</key>
<string>Ginga</string>
</dict>
</plist>
"""
from ginga import __version__
d = dict(version=__version__, build=__version__.replace('.', ''))
plist = info_plist_template % d
with open('Info.plist', 'w') as out_f:
out_f.write(plist)
APP = ['Ginga.py']
DATA_FILES = []
OPTIONS = {'argv_emulation': True,
'compressed': True,
#'packages': 'ginga,scipy,numpy,kapteyn,astropy,PIL,matplotlib',
'packages': 'ginga,scipy,numpy,astropy,PIL,matplotlib',
'includes': ['sip', 'PyQt4._qt',],
# currently creating some problems with the app build on mac os x
# so exclude
'excludes': ['cv2',],
'matplotlib_backends': 'Qt4Agg',
}
if sys.platform == 'darwin':
# mac-specific options
OPTIONS['plist'] = 'Info.plist'
OPTIONS['iconfile'] = 'Ginga.icns'
extra_options = dict(
setup_requires=['py2app'],
options={'py2app': OPTIONS},
)
elif sys.platform == 'win32':
extra_options = dict(
setup_requires=['py2exe'],
options={'py2exe': OPTIONS},
)
else:
extra_options = dict(
# Normally unix-like platforms will use "setup.py install"
# and install the main script as such
scripts=["ginga"],
)
setup_requires=['py2app'],
setup(
name="Ginga",
app=APP,
data_files=DATA_FILES,
**extra_options
)
|