update build script
This commit is contained in:
parent
1f8f9ffa7d
commit
3c010a6f99
1 changed files with 40 additions and 12 deletions
|
@ -9,7 +9,7 @@ import re
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
def build_oxjs(geo):
|
def build_oxjs(geo):
|
||||||
|
|
||||||
|
@ -17,14 +17,18 @@ def build_oxjs(geo):
|
||||||
if base_path:
|
if base_path:
|
||||||
os.chdir(base_path)
|
os.chdir(base_path)
|
||||||
|
|
||||||
source_path = '../../source/'
|
root_path = '../../'
|
||||||
build_path = '../../build/'
|
source_path = root_path + 'source/'
|
||||||
dev_path = '../../dev/'
|
build_path = root_path + 'build/'
|
||||||
|
dev_path = root_path + 'dev/'
|
||||||
|
|
||||||
version = '0.1.%s' % subprocess.Popen(
|
version = '0.1.%s' % subprocess.Popen(
|
||||||
['bzr', 'revno'],
|
['bzr', 'revno'],
|
||||||
stdout=subprocess.PIPE
|
stdout=subprocess.PIPE
|
||||||
).communicate()[0].strip()
|
).communicate()[0].strip()
|
||||||
comment = 'OxJS %s (c) 2012 0x2620, dual-licensed GPL/MIT, see http://oxjs.org for details' % version
|
year = time.strftime('%Y', time.gmtime())
|
||||||
|
comment = 'OxJS %s (c) %s 0x2620, dual-licensed GPL/MIT, see https://oxjs.org for details' % (version, year)
|
||||||
|
|
||||||
# SVGs
|
# SVGs
|
||||||
path = source_path + 'Ox.UI/themes/classic/svg/'
|
path = source_path + 'Ox.UI/themes/classic/svg/'
|
||||||
for filename in os.listdir(path):
|
for filename in os.listdir(path):
|
||||||
|
@ -89,11 +93,11 @@ def build_oxjs(geo):
|
||||||
]
|
]
|
||||||
js = ''
|
js = ''
|
||||||
js_dir = 'Ox/js/'
|
js_dir = 'Ox/js/'
|
||||||
data = [[], [], []]
|
ox_files = [[], [], []]
|
||||||
for filename in filenames[0]:
|
for filename in filenames[0]:
|
||||||
data[0].append(js_dir + filename)
|
ox_files[0].append(js_dir + filename)
|
||||||
for filename in filenames[1]:
|
for filename in filenames[1]:
|
||||||
data[1].append(js_dir + filename)
|
ox_files[1].append(js_dir + filename)
|
||||||
filenames = filenames[0] + filenames[1]
|
filenames = filenames[0] + filenames[1]
|
||||||
for filename in os.listdir(source_path + js_dir):
|
for filename in os.listdir(source_path + js_dir):
|
||||||
if not filename in filenames \
|
if not filename in filenames \
|
||||||
|
@ -102,11 +106,11 @@ def build_oxjs(geo):
|
||||||
filenames.append(filename)
|
filenames.append(filename)
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
js += read_file(source_path + js_dir + filename) + '\n'
|
js += read_file(source_path + js_dir + filename) + '\n'
|
||||||
if not js_dir + filename in data[0] + data[1]:
|
if not js_dir + filename in ox_files[0] + ox_files[1]:
|
||||||
data[2].append(js_dir + filename)
|
ox_files[2].append(js_dir + filename)
|
||||||
js = js.replace("Ox.VERSION = '0.1.2';", "Ox.VERSION = '%s';" % version)
|
js = re.sub("Ox.VERSION = '([\d\.]+)'", "Ox.VERSION = '%s'" % version, js)
|
||||||
write_file(build_path + 'Ox.js', ox.js.minify(js, comment))
|
write_file(build_path + 'Ox.js', ox.js.minify(js, comment))
|
||||||
write_file(dev_path + '/Ox/json/' + 'Ox.json', json.dumps(data, indent=4))
|
write_file(dev_path + '/Ox/json/' + 'Ox.json', json.dumps(ox_files, indent=4))
|
||||||
|
|
||||||
# Ox.UI
|
# Ox.UI
|
||||||
js = ''
|
js = ''
|
||||||
|
@ -136,6 +140,30 @@ def build_oxjs(geo):
|
||||||
files = json.dumps(sorted(ui_files['dev']), indent=4)
|
files = json.dumps(sorted(ui_files['dev']), indent=4)
|
||||||
write_file(dev_path + 'Ox.UI/json/Ox.UI.files.json', files)
|
write_file(dev_path + 'Ox.UI/json/Ox.UI.files.json', files)
|
||||||
|
|
||||||
|
# index
|
||||||
|
data = {
|
||||||
|
# sum(list, []) is flatten
|
||||||
|
'documentation': sorted(sum(ox_files, [])) + sorted(filter(
|
||||||
|
lambda x: re.match('.+\.js$', x),
|
||||||
|
ui_files['dev']
|
||||||
|
) + map(
|
||||||
|
lambda x: 'Ox.%s/Ox.%s.js' % (x, x),
|
||||||
|
['Geo', 'Image', 'Unicode']
|
||||||
|
)),
|
||||||
|
'examples': filter(
|
||||||
|
lambda x: not re.match('^\.', x),
|
||||||
|
os.listdir(root_path + 'examples/')
|
||||||
|
),
|
||||||
|
'readme': map(
|
||||||
|
lambda x: x.split('.')[0],
|
||||||
|
filter(
|
||||||
|
lambda x: not re.match('^[\._]', x),
|
||||||
|
os.listdir(root_path + 'readme/html')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
write_file(root_path + 'index.json', json.dumps(data, indent=4, sort_keys=True))
|
||||||
|
|
||||||
|
|
||||||
def copy_file(source, target):
|
def copy_file(source, target):
|
||||||
print 'copying', source, 'to', target
|
print 'copying', source, 'to', target
|
||||||
|
|
Loading…
Reference in a new issue