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 from os import getcwd, path, sep, system, walk
26 from re import search
27 from tarfile import TarFile
28 from zipfile import ZipFile
29
30
31 from version import version
32
33
34
36 """Builder action for creating a GPG signature of the binary distribution file."""
37
38
39 print
40 print "############################################"
41 print "# GPG signing the binary distribution file #"
42 print "############################################\n\n"
43
44
45 type_list = [env['DIST_TYPE']]
46 if type_list[0] == 'ALL':
47 type_list = ['zip', 'tar']
48
49
50 for dist_type in type_list:
51
52 if dist_type == 'zip':
53 file = env['DIST_FILE'] + '.zip'
54 elif dist_type == 'tar':
55 file = env['DIST_FILE'] + '.tar.bz2'
56
57
58 print "\n\nSigning the distribution package " + `file` + ".\n"
59
60
61 system("gpg --detach-sign --default-key relax " + path.pardir + path.sep + file)
62
63
64 print "\n\n\n"
65
66
68 """Builder action for packaging the distribution archives."""
69
70
71 print
72 print "#######################"
73 print "# Packaging the files #"
74 print "#######################"
75
76
77 type_list = [env['DIST_TYPE']]
78 if type_list[0] == 'ALL':
79 type_list = ['zip', 'tar']
80
81
82 for dist_type in type_list:
83
84 if dist_type == 'zip':
85 file = env['DIST_FILE'] + '.zip'
86 elif dist_type == 'tar':
87 file = env['DIST_FILE'] + '.tar.bz2'
88
89
90 print "\n\nCreating the package distribution " + `file` + ".\n"
91
92
93 if dist_type == 'zip':
94 archive = ZipFile(path.pardir + path.sep + file, 'w', compression=8)
95
96
97 elif dist_type == 'tar':
98 if search('.bz2$', file):
99 archive = TarFile.bz2open(path.pardir + path.sep + file, 'w')
100 elif search('.gz$', file):
101 archive = TarFile.gzopen(path.pardir + path.sep + file, 'w')
102 else:
103 archive = TarFile.open(path.pardir + path.sep + file, 'w')
104
105
106 base = getcwd() + sep
107
108
109 for root, dirs, files in walk(getcwd()):
110
111 if search("\.svn", root):
112 continue
113
114
115 for i in xrange(len(files)):
116
117 if search("\.sconsign", files[i]) or search("^\.", files[i]) or search("\.pyc$", files[i]) or search("\.o$", files[i]) or search("\.os$", files[i]) or search("\.obj$", files[i]) or search("\.lib$", files[i]) or search("\.exp$", files[i]):
118 continue
119
120
121 name = path.join(root, files[i])
122 name = name[len(base):]
123 print 'relax-' + version + path.sep + name
124
125
126 arcname = 'relax-' + version + path.sep + name
127
128
129 if dist_type == 'zip':
130 archive.write(filename=name, arcname=arcname)
131
132
133 if dist_type == 'tar':
134 archive.add(name=name, arcname=arcname)
135
136
137 archive.close()
138
139
140 print "\n\n\n"
141