forked from open-cogsci/OpenSesame
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup-mac.py
95 lines (81 loc) · 2.69 KB
/
setup-mac.py
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
#!/usr/bin/env python
#-*- coding:utf-8 -*-
"""
This file is part of OpenSesame.
OpenSesame is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenSesame is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenSesame. If not, see <http://www.gnu.org/licenses/>.
This scripts builds OpenSesame as a standalone application for Mac OS.
Usage:
python setup.py py2app
"""
from setuptools import setup
import os
import shutil
# Clean up previous builds
try:
shutil.rmtree("dist")
except:
pass
try:
shutil.rmtree("build")
except:
pass
# Copy qt_menu.nib folder
try:
shutil.rmtree("qt_menu.nib")
except:
pass
shutil.copytree("/usr/local/Frameworks/QtGui.framework/Resources/qt_menu.nib", "qt_menu.nib")
# Py2app doesn't like extensionless Python scripts
try:
os.remove("opensesame.py")
os.remove("opensesamerun.py")
except:
pass
shutil.copyfile("opensesame", "opensesame.py")
shutil.copyfile("opensesamerun", "opensesamerun.py")
# Build!
setup(
app = ['opensesame.py'],
data_files = ['opensesame.py'],
options = {'py2app' :
{'argv_emulation': False,
'includes' : ['PyQt4.QtNetwork','serial','opensesamerun','skimage','sip','billiard','wx'],
'excludes': ['Finder','idlelib', 'gtk', 'sqlite3', 'matplotlib', 'pandas', 'PyQt4.QtDesigner',\
'PyQt4.QtOpenGL', 'PyQt4.QtScript', 'PyQt4.QtSql', 'PyQt4.QtTest', 'PyQt4.QtXml', 'PyQt4.phonon',\
'rpy2',
],
'resources' : ['qt_menu.nib', 'resources', 'sounds', 'plugins', 'extensions', 'help', 'data', 'examples'],
'packages' : ['openexp','expyriment','psychopy','QProgEdit','libqtopensesame','libopensesame'],
'iconfile' : 'resources/opensesame.icns',
'plist': {
'CFBundleName': 'OpenSesame',
'CFBundleShortVersionString':'2.9.4',
'CFBundleVersion': '2.9.4',
'CFBundleIdentifier':'nl.cogsci.osdoc',
'NSHumanReadableCopyright': 'Sebastiaan Mathot (2010-2015)',
'CFBundleDevelopmentRegion': 'English',
}
}
},
setup_requires=['py2app'],
)
# Clean up qt_menu.nib
shutil.rmtree("qt_menu.nib")
# Remove unwanted plugins from build
shutil.rmtree("dist/opensesame.app/Contents/Resources/plugins/pp_io")
shutil.rmtree("dist/opensesame.app/Contents/Resources/plugins/port_reader")
# Remove opensesame.py
try:
os.remove("opensesame.py")
os.remove("opensesamerun.py")
except:
pass