17
17
NS_CC = Namespace ("http://creativecommons.org/ns#" )
18
18
NS_RDF = Namespace ("http://www.w3.org/1999/02/22-rdf-syntax-ns#" )
19
19
20
+ def checkout_base ():
21
+ """Return the base destination path. Note that this assumes you're
22
+ running the tool from a Subversion checkout (or that your filesystem
23
+ layout is the same as our repository)."""
24
+
25
+
26
+ return os .path .abspath (
27
+ os .path .join (os .path .dirname (__file__ ), '..' , '..' , '..' )
28
+ )
29
+
20
30
def load_graph (filename ):
21
31
"""Load the specified filename; return a graph."""
22
32
@@ -33,10 +43,13 @@ def load_graph(filename):
33
43
def copyto (source , dest , code , size , jurisdiction , money ):
34
44
if (not os .access (dest , os .F_OK )):
35
45
os .makedirs (dest )
36
- dest += size + '.png'
46
+
47
+ dest = os .path .join (dest , size + '.png' )
48
+
37
49
if string .find (code , 'nc' ) != - 1 and money .has_key (jurisdiction ):
38
50
source += '_' + money [jurisdiction ]
39
51
source += '.png'
52
+
40
53
try :
41
54
shutil .copy2 (source , dest )
42
55
except :
@@ -65,7 +78,9 @@ def splat(license_graph):
65
78
code = m .group (1 )
66
79
version = m .group (3 )
67
80
jurisdiction = m .group (5 )
68
- dest = '../www/l/' + code + '/'
81
+
82
+ dest = os .path .join (checkout_base (), 'www' , 'l' , code )
83
+
69
84
code2 = code
70
85
size = '88x31'
71
86
if (code == 'by-nd-nc' ):
@@ -75,12 +90,13 @@ def splat(license_graph):
75
90
elif (code == 'LGPL' or code == 'GPL' ):
76
91
size = '88x62'
77
92
if (version ):
78
- dest += version + '/'
93
+ dest = os . path . join ( dest , version )
79
94
if (jurisdiction ):
80
- dest += jurisdiction + '/'
81
- source = '../base-images/' + size + '/' + code2
95
+ dest = os .path .join (dest , jurisdiction )
96
+
97
+ source = os .path .join (checkout_base (), 'base-images' , size , code2 )
82
98
copyto (source , dest , code , size , jurisdiction , money )
83
- source = '../ base-images/' + '80x15' + '/' + code2
99
+ source = os . path . join ( checkout_base (), ' base-images' , '80x15' , code2 )
84
100
copyto (source , dest , code , '80x15' , '' , money )
85
101
86
102
def cli ():
0 commit comments