Newer
Older
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# -*- coding: utf-8 -*-
"""
Configure the build process for the plugin dbui
"""
import os
import re
import tempfile
# ............................................................................
#
# JAVASCRIPT LIBRARY
# JavaScript source code and compile version
# paths are relative to the static directory
#
SENCHA_CLS = [
"plugin_extjs/packages/core/src",
"plugin_extjs/classic/classic/src",
"plugin_extjs/classic/classic/overrides",
"plugin_dbui/src"]
SENCHA_NS = "Ext"
JSLIBDEBUG = "plugin_dbui/dbui-debug.js"
JSLIBMIN = "plugin_dbui/dbui-min.js"
# ...........................................................................
#
# DOCUMENTATION
# output directories for documentation
# paths are relative to the static directory
#
DOCS_DIR = "plugin_dbui/docs"
JSDOC = "plugin_dbui/docs/jsduck"
LATEXDOC = "plugin_dbui/docs/latex"
PDFDOC = "plugin_dbui/docs/pdf"
# ...........................................................................
#
# PLUGINS
# ace, dbui, extjs and mathjax
# paths are relative to the application directory
#
PLUGINS_FILES = {}
PLUGINS_FILES["default"] = [
"controllers/plugin_%s.py",
"models/plugin_%s.py",
"modules/plugin_%s",
"private/plugin_%s",
"static/plugin_%s",
"views/plugin_%s"]
PLUGINS_FILES["ace"] = [
"static/plugin_ace/src-min-noconflict/ace.js",
"static/plugin_ace/src-min-noconflict/mode-json.js",
"static/plugin_ace/src-min-noconflict/theme-crimson_editor.js",
"static/plugin_ace/src-min-noconflict/worker-json.js"]
PLUGINS_FILES["dbui"] = [
"modules/plugin_dbui",
"models/plugin_dbui.py",
"controllers/plugin_dbui.py",
"views/plugin_dbui",
"static/plugin_dbui/resources/css/kde-oxygen.css",
"static/plugin_dbui/resources/css/dbui.css",
"static/plugin_dbui/resources/icons",
"static/plugin_dbui/src",
"static/plugin_dbui/locale/dbui-lang-en.js",
"static/plugin_dbui/locale/dbui-lang-fr.js",
"static/plugin_dbui/dbui-min.js",
"static/plugin_dbui/docs"]
PLUGINS_FILES["extjs"] = [
"static/plugin_extjs/build/classic/locale",
"static/plugin_extjs/build/classic/theme-classic",
"static/plugin_extjs/build/ext-all.js",
"static/plugin_extjs/build/ext-all-debug.js",
"static/plugin_extjs/classic/classic/src",
"static/plugin_extjs/classic/classic/overrides",
"static/plugin_extjs/packages/core/src",
"static/plugin_extjs/version.properties"]
PLUGINS_FILES["mathjax"] = [
"static/plugin_mathjax/fonts/HTML-CSS/TeX/woff",
"static/plugin_mathjax/images",
"static/plugin_mathjax/jax",
"static/plugin_mathjax/extensions",
"static/plugin_mathjax/MathJax.js"]
# ............................................................................
#
# REFERENCE FILES
# - path are relative to the static repository
#
DBUIJS = "plugin_dbui/src/Dbui.js"
def commit_release():
"""Commit release CHANGELOG, VERSION and DBUIJS files
"""
print "\n", "."*79
print "\n\tCommit CHANGELOG, DBUIJS, VERSION, ..."
if not which("git", localhost=True):
error('\n\tThe application git is missing !')
print '\tSkip this step.\n'
return
# move to the master branch
git("checkout master")
# Commit modified files
print '\n\tgit add', DBUIJS, CHANGELOG, VERSION
git("add", DBUIJS, CHANGELOG, VERSION)
msg = "Start release candidate %s" % get_version()
print '\tgit commit:', msg
git("commit -m", msg)
def get_plugin_version(plugin):
"""
Args:
plugin (str): name of the plugin
Return:
str: the plugin version
"""
if plugin == "ace":
cwd = os.getcwd()
os.chdir("static/plugin_ace")
with tempfile.TemporaryFile() as tmpfile:
git("describe --tags", stdout=tmpfile)
tmpfile.seek(0)
release = tmpfile.read()
release = release.replace("v", "").replace("\n", "")
os.chdir(cwd)
elif plugin == "dbui":
filename = os.path.join("static", DBUIJS)
with open(filename, "rb") as tmpfile:
text = tmpfile.read()
match = re.match(r"(.+ version: ')([\w._-]*)('.+)", text, re.DOTALL)
release = match.group(2)
elif plugin == "extjs":
fn = os.path.join('static', 'plugin_extjs', 'version.properties')
if not os.path.exists(fn):
error("\n\tNo version file for the plugin extjs !")
sys.exit(1)
with open(fn, 'rb') as fi:
s = fi.read()
match = re.search(r"version.release=(\d+(\.\d+)*)", s)
if not match:
error("\n\tExt JS release number not defined !")
sys.exit(1)
release = match.group(1)
elif plugin == "mathjax":
filename = os.path.join('static', 'plugin_mathjax', 'MathJax.js')
with open(filename, 'rb') as tmpfile:
text = tmpfile.read()
match = re.match(r'.+MathJax.version="(\d+(\.\d+)*)";', text, re.DOTALL)
if not match:
error("\n\tMathJax release number not defined !")
sys;exit(1)
release = match.group(1)
else:
error("\n\tUnknown plugin %" % plugin)
sys.exit(1)
# shrink the release identifier 4.2.1 or 4.2.1.883 -> 421
li = release.split('.')
release = ''.join(li) if len(li) < 4 else ''.join(li[:-1])
if len(release) == 2:
release = "%s0" % release
return release
def set_version(version):
"""Set release identifier in CHANGELOG, VERSION and Dbui.js
Args:
version (str): release identifier
"""
print "\n", "."*79
print "Update CHANGELOG and Dbui.js files with release", version, "..."
# check tag in git
if version in check_output(["git", "tag"]).split("\n"):
print "\n\tRelease %s already exit in git" % version
sys.exit(1)
print 'Set release', version, 'in', DBUIJS
with open(DBUIJS) as fi:
txt = fi.read()
# look for a pattern Dbui.version = '0.8.3'; in appbase.js
# split the the string in 3 parts (pre, version, post)
match = re.match(r"(.+ version: ')([\w._-]*)('.+)", txt, re.DOTALL)
if match.group(2) == version:
msg = '\n\tVersion "%s" already exists in the Dbui.js file !'
print msg % version
rep = raw_input('\tDo you want to continue [n]?')
if rep not in ('y', 'yes'):
sys.exit(1)
# update the version and write a new file
txt = match.group(1) + version + match.group(3)
with open(DBUIJS, 'w') as fi:
fi.write(txt)
# look for a pattern HEAD in the CHANGELOG
# split the the string in 2 parts (pre HEAD, post HEAD)
print 'Set release', version, 'in', CHANGELOG
with open(CHANGELOG) as fi:
txt = fi.read()
match = re.match("(.+HEAD\n)(.*)", txt, re.DOTALL)
if match is None:
print '\n\tNo HEAD tag in the CHANGELOG!\n'
rep = raw_input('\tDo you want to continue [n]?')
if rep not in ('y', 'yes'):
sys.exit(1)
# update the version and edit the CHANGELOG
tpl = (match.group(1), version, NOW.strftime('%b %Y'), match.group(2))
txt = '%s\n%s (%s)\n%s' % tpl
with open(CHANGELOG, 'w') as fi:
fi.write(txt)
call(["vim", CHANGELOG])
# update VERSION
print 'Set release', version, 'in', VERSION
with open(VERSION, 'w') as fi:
fi.write(version)
# cleaning
fn = "%s~" % CHANGELOG
if os.path.exists(fn):
os.remove(fn)