-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathmac-setup.py
112 lines (97 loc) · 3.53 KB
/
mac-setup.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/python
# setup.py
from distutils.core import setup
from exe.engine.path import Path
from exe.engine import version
import os
import httplib2
import certifi
import py2app
# Make main.py if it doesn't exist
if not Path('exe/main.py').exists():
lines = open('exe/exe').readlines()
for i, line in enumerate(lines):
if line.startswith('import'):
lines.insert(i, 'import decimal\n')
break
output = open('exe/main.py', 'w')
output.writelines(lines)
output.close()
files = {'../Resources/exe': ["README",
"COPYING",
"NEWS",
"ChangeLog",
"exe/webui/mr_x.gif"],
'../Resources': ["exe_elp.icns", os.path.join(os.path.dirname(certifi.__file__), 'cacert.pem')],
}
def dataFiles(baseSourceDir, baseDestDir, sourceDirs, excludes=[]):
"""Recursively get all the files in these directories"""
baseSourceDir = Path(baseSourceDir)
baseDestDir = Path(baseDestDir)
sourceDirs = map(Path, sourceDirs)
for sourceDir in sourceDirs:
sourceDir = baseSourceDir / sourceDir
for subDir in list(sourceDir.walkdirs()) + [sourceDir]:
if '.svn' in subDir.splitall():
continue
newExtDir = baseSourceDir.relpathto(subDir)
fileList = files.setdefault(baseDestDir / newExtDir, [])
for file in subDir.files():
if file.name not in excludes:
fileList.append(file)
# Add all the webui dirs
dataFiles('exe/webui', '../Resources/exe',
[
'style', 'content_template', 'css', 'images', 'docs',
'scripts', 'schemas', 'templates',
'tools'
],
excludes=['mimetex.exe'])
# Process metadata validation rules
files['../Resources/exe'].append('exe/webui/exportvalidation.json')
# Add in the
dataFiles('exe', '../Resources/exe', ['locale'])
dataFiles('exe/jsui', '../Resources/exe', ['scripts', 'templates'])
import sys
print sys.path
plist = dict(
CFBundleDocumentTypes=[
dict(
CFBundleTypeExtensions=['elp'],
CFBundleTypeIconFile='exe_elp.icns',
CFBundleTypeMIMETypes=['text/xml'],
CFBundleTypeName='Binary',
CFBundleTypeRole='Editor',
LSTypeIsPackage=False,
NSDocumentClass='MyDocument',
NSPersistentStoreTypeKey='Binary',
),
],
)
py2appParams = {
'includes': 'PngImagePlugin,JpegImagePlugin,GifImagePlugin,IcoImagePlugin,BmpImagePlugin,BaseHTTPServer',
'packages': 'encodings,nevow,lxml,PIL',
'argv_emulation': True,
'semi_standalone': False,
'plist': plist,
'iconfile': 'exe.icns'
}
setup(name=version.project,
version=version.version,
description="The EXtremely Easy to use eLearning authoring tool",
long_description="""\
The eXe project is an authoring environment to enable teachers to publish
web content without the need to become proficient in HTML or XML markup.
Content generated using eXe can be used by any Learning Management System.
""",
url="http://exelearning.net",
author="INTEF-eXe Project",
author_email="[email protected]",
license="GPL",
packages=["exe", "exe.webui", "exe.jsui",
"exe.engine", "exe.export", "exe.importers", "exe.engine.lom", "exe.engine.exceptions"],
data_files=files.items(),
app=["exe/main.py"],
options={'py2app': py2appParams},
setup_requires=["py2app"],
)