-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.py
More file actions
executable file
·104 lines (81 loc) · 3.08 KB
/
build.py
File metadata and controls
executable file
·104 lines (81 loc) · 3.08 KB
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
#!/usr/bin/python3
import os
import os.path
import shutil
import glob
import re
import sys
def copy_bluej_file(path):
shutil.copyfile(path, 'dst' + path[3:])
def copy_bluej_tree(path):
shutil.copytree(path, 'dst' + path[3:])
win_version_exists = os.path.exists('src/bluej/BlueJ.exe')
other_version_exists = os.path.exists('src/bluej/bluej')
if not win_version_exists and not other_version_exists:
print('ERROR: unpack bluej to the src/bluej directory')
sys.exit(1)
if os.path.exists('dst/bluej'):
print('=== removing old bluej destination directory')
shutil.rmtree('dst/bluej')
print('=== detecting BlueJ version')
re_version = re.compile('[0-9]+.[0-9]+.[0-9]+')
with open('src/bluej/README.TXT', 'r') as readme:
for line in readme:
match_version = re_version.search(line)
if match_version is not None:
version = match_version.group(0)
break
else:
print('ERROR: version not found')
sys.exit(1)
print('Found: ' + version)
print('=== creating new bluej destination directory')
os.mkdir('dst/bluej')
os.mkdir('dst/bluej/lib')
print('=== copying icons')
copy_bluej_tree('src/bluej/icons')
print('=== copying fonts')
copy_bluej_tree('src/bluej/lib/fonts')
print('=== copying images')
copy_bluej_tree('src/bluej/lib/images')
print('=== copying stylesheets')
copy_bluej_tree('src/bluej/lib/stylesheets')
print('=== copying userlib README')
os.mkdir('dst/bluej/lib/userlib')
copy_bluej_file('src/bluej/lib/userlib/README.TXT')
print('=== copying english translations')
os.mkdir('dst/bluej/lib/english')
for file in glob.glob('src/bluej/lib/english/*'):
if not os.path.isdir(file):
copy_bluej_file(file)
print('=== copying modified templates')
shutil.copytree('data/templates', 'dst/bluej/lib/english/templates')
print('=== copying original template READMEs')
copy_bluej_file('src/bluej/lib/english/templates/README')
copy_bluej_file('src/bluej/lib/english/templates/newclass/README')
print('=== copying checkstyle extension')
os.mkdir('dst/bluej/lib/extensions')
shutil.copyfile('data/checkstyle/default_checks.xml', 'dst/bluej/lib/extensions/default_checks.xml')
shutil.copyfile('src/checkstyle-extension-5.4.1.jar', 'dst/bluej/lib/extensions/checkstyle-extension-5.4.1.jar')
print('=== copying libraries')
for file in glob.glob('src/bluej/lib/*'):
if not os.path.isdir(file):
copy_bluej_file(file)
print('=== copying project README and licences')
copy_bluej_file('src/bluej/README.TXT')
copy_bluej_file('src/bluej/LICENSE.txt')
copy_bluej_file('src/bluej/THIRDPARTYLICENSE.txt')
print('=== copying BlueJ.exe')
if win_version_exists:
copy_bluej_file('src/bluej/BlueJ.exe')
else:
shutil.copyfile('data/unix/bluej', 'dst/bluej/bluej')
os.chmod('dst/bluej/bluej', 0o755)
if win_version_exists:
print('=== copying jdk')
copy_bluej_tree('src/bluej/jdk')
copy_bluej_tree('src/bluej/lib/javafx')
print('=== copying setup.iss config and modifying it')
with open('data/setup.iss', 'r') as src:
with open('dst/setup.iss', 'w') as dst:
dst.write(src.read().replace('###VER###', version))