-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathrpm-setup.py
executable file
·149 lines (134 loc) · 4.18 KB
/
rpm-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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#!/usr/bin/python
# rpm-setup.py
# Create a RPM package
import os.path
import glob
from distutils.core import setup
from exe.engine import version
# Files that are going to be copied (We add these ones manually)
g_files = {
'/usr/share/exe': [
# Although this is a copy of debian/changelog.gz
"ChangeLog",
# Removed, this is the GPL - to copyright
#"COPYING",
# No longer used, after bug 2284 was fixed
#"NEWS"
],
# ReadMe file
'/usr/share/doc/intef-exe': ["README"],
# eXe main icon
'/usr/share/icons/hicolor/48x48/apps': ["exe.png"],
# eXe XPM icon
'/usr/share/pixmaps': ["exe.xpm"]
}
def dataFiles(dirs, excludes = []):
"""
Recursively get all the files in these 'dirs' directories
except those listed in 'excludes'
"""
# Get global variables
global dataFiles, g_oldBase, g_newBase, g_files
# Go throught all files
for file in dirs:
# This will prevent it from copying hidden or excluded files
if not os.path.basename(file[0]).startswith("."):
# If it is a file
if os.path.isfile(file) and file not in excludes:
# We get only the part after that from the file path
path = file[len(g_oldBase) + 1:]
# Get the full new path
dir = g_newBase + "/" + os.path.dirname(path)
# If the path is already in the array
if dir in g_files:
# Append the file
g_files[dir].append(file)
# If it is not
else:
# Create a new array with the file
g_files[dir] = [file]
# If is is a directory
elif os.path.isdir(file) and file not in excludes:
# Call this function with the subdirectory
dataFiles(glob.glob(file + "/*"), excludes)
# Source dir
g_oldBase = "exe/webui"
# Destination dir
g_newBase = "/usr/share/exe"
# Process WebUI files
dataFiles(
[
"exe/webui/style",
"exe/webui/content_template",
"exe/webui/css",
# jrf - task 1080, the manual is no longer included
# "exe/webui/docs",
"exe/webui/images",
"exe/webui/schemas",
"exe/webui/scripts",
"exe/webui/templates",
"exe/webui/tools"
],
excludes = [
"exe/webui/templates/mimetex-darwin.cgi",
"exe/webui/templates/mimetex.exe"
]
)
# Process metadata validation rules
g_oldBase = "exe/webui"
g_newBase = "/usr/share/exe"
dataFiles(['exe/webui/exportvalidation.json'])
# Process locales folder
# jrf - bug 2402, to comply with the FHS
g_oldBase = "exe/locale"
g_newBase = "/usr/share/locale"
# We exclude PO files, the POT file and japanese XLF files
excludes = glob.glob(g_oldBase + "/*/LC_MESSAGES/*.po")
excludes.append(g_oldBase + "/ja/exe_jp.xlf")
excludes.append(g_oldBase + "/ja/exe_ja.xlf")
excludes.append(g_oldBase + "/messages.pot")
excludes.sort()
dataFiles(["exe/locale"], excludes)
# Process JSUI files
g_oldBase = "exe/jsui"
g_newBase = "/usr/share/exe"
dataFiles(["exe/jsui/scripts", "exe/jsui/templates"])
# Run the setup
setup(
# Project name
name = version.project,
# Project version
version = version.version,
# Project description
description = "The EXtremely Easy to use eLearning authoring tool",
# Project long description
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.
""",
# Project homepage
url = "http://exelearning.net",
# Project author
author = "INTEF-eXe Project",
# Author email
author_email = "[email protected]",
# Project license
license = "GPL",
# Executable files
scripts = ["exe/exe", "exe/exe_do"],
# Project packages
packages=[
"exe",
"exe.webui",
"exe.jsui",
"exe.engine",
"exe.export",
"exe.importers",
"exe.engine.lom",
"exe.engine.exceptions"
],
# Files list
data_files = g_files.items()
)