-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup_genecount.py
97 lines (89 loc) · 3.85 KB
/
setup_genecount.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
96
97
"""
This is a setup.py script generated by py2applet
Usage:
python setup.py py2app --includes sip
"""
#Blah Blah
import os
import sys
import glob
from setuptools import setup
if sys.platform == 'darwin':
import py2app
elif sys.platform == 'win32':
import py2exe
sys.setrecursionlimit(100000)
def find_data_files(sources, targets, patterns):
"""Locates the specified data-files and returns the matches
in a data_files compatible format.
source is the root of the source data tree.
Use '' or '.' for current directory.
target is the root of the target data tree.
Use '' or '.' for the distribution directory.
patterns is a sequence of glob-patterns for the
files you want to copy.
"""
ret = {}
for i, source in enumerate(sources):
target = targets[i]
if glob.has_magic(source) or glob.has_magic(target):
raise ValueError("Magic not allowed in src, target")
pattern = os.path.join(source, patterns[i])
for filename in glob.glob(pattern):
if os.path.isfile(filename):
targetpath = os.path.join(target, os.path.relpath(filename, source))
path = os.path.dirname(targetpath)
ret.setdefault(path, []).append(filename)
return sorted(ret.items())
VERSION = os.environ['DEEPN_VERSION']
BUNDLE_VERSION = VERSION.replace(".", "")
APP = ['gene_count_gui.py']
INCLUDES = ['PyQt4', 'glob', 'cPickle', 'time', 'sys', 'os', 'pydoc',
'json', 'numbers', 'hashlib', 'decimal', 'pyqtgraph', 'copy']
OPTIONS = {'argv_emulation': True,
'iconfile' : 'icon/Icon2.icns',
'plist': {'CFBundleGetInfoString': 'Gene Count',
'CFBundleIdentifier': 'edu.uiowa.robertpiper.deepn.gene_count',
'CFBundleShortVersionString': VERSION,
'CFBundleName': 'Gene Count',
'CFBundleVersion': BUNDLE_VERSION,
'NSHumanReadableCopyright': '(c) 2016 Venkatramanan Krishnamani, Robert C. Piper, Mark Stammnes'},
'includes': INCLUDES,
'excludes': ['PyQt4.QtDesigner', 'PyQt4.QtNetwork', 'PyQt4.QtOpenGL', 'PyQt4.QtScript', 'PyQt4.QtSql', 'PyQt4.QtTest', 'PyQt4.QtWebKit', 'PyQt4.QtXml', 'PyQt4.phonon'],
}
DATA_FILES = find_data_files(['functions', 'libraries', 'libraries/joblib', 'libraries/bintrees', 'ui', 'dictionaries', '.', 'ui/Windows'],
['functions', 'libraries', 'libraries/joblib', 'libraries/bintrees', 'ui', 'dictionaries', '', 'ui/Windows'],
['*.py', '*.py', '*.py', '*.py', '*.ui', '*', '*.txt', '*.ui'])
if sys.platform == 'darwin':
setup(
app=APP,
name='Gene Count',
options={'py2app': OPTIONS},
setup_requires=['py2app'],
author='Venkatramanan Krishnamani, Robert C. Piper, Mark Stammnes',
data_files=DATA_FILES,
)
elif sys.platform == 'win32':
origIsSystemDLL = py2exe.build_exe.isSystemDLL
def isSystemDLL(pathname):
if os.path.basename(pathname).lower() in ("msvcp71.dll", "dwmapi.dll", "'msvcp90.dll'"):
return 0
return origIsSystemDLL(pathname)
py2exe.build_exe.isSystemDLL = isSystemDLL
setup(
console=APP,
version=VERSION,
description='Gene Count',
author='Venkatramanan Krishnamani, Robert C. Piper, Mark Stammnes',
# windows=[{"script":'gene_count_gui.py',
# "icon_resources": [(1, "icon/Icon2.ico")],
# "dest_base":"Gene Count"
# }],
data_files=DATA_FILES,
options={"py2exe": {'includes': INCLUDES,
"optimize": 2,
"compressed": 2,
"bundle_files": 1,
"dist_dir": "dist\Gene Count"
}}
)