34
34
'^*.bzr/*' ,
35
35
'^*.svn/*' ,
36
36
37
+ # pyc/py
38
+ '*.pyc' ,
39
+ '*.py' ,
40
+
37
41
# temp files
38
42
'~' ,
39
- '.bak' ,
40
- '.swp' ,
43
+ '* .bak' ,
44
+ '* .swp' ,
41
45
]
42
46
43
47
python_files = []
@@ -66,7 +70,8 @@ def compile_dir(dfn):
66
70
'''
67
71
68
72
# -OO = strip docstrings
69
- subprocess .call ([PYTHON ,'-OO' ,'-m' ,'compileall' ,'-f' ,dfn ])
73
+ subprocess .call ([PYTHON ,'-OO' ,'-m' ,'compileall' ,'-f' , dfn ],
74
+ stdout = subprocess .PIPE , stderr = subprocess .PIPE )
70
75
71
76
def is_blacklist (name ):
72
77
for pattern in BLACKLIST_PATTERNS :
@@ -127,14 +132,19 @@ def select(fn):
127
132
zf .close ()
128
133
129
134
130
- def make_tar (fn , source_dirs , ignore_path = []):
135
+ def make_tar (tfn , source_dirs , ignore_path = []):
131
136
'''
132
137
Make a zip file `fn` from the contents of source_dis.
133
138
'''
134
139
135
140
# selector function
136
141
def select (fn ):
137
142
rfn = realpath (fn )
143
+ for p in ignore_path :
144
+ if p .endswith ('/' ):
145
+ p = p [:- 1 ]
146
+ if rfn .startswith (p ):
147
+ return False
138
148
if rfn in python_files :
139
149
return False
140
150
return not is_blacklist (fn )
@@ -146,9 +156,10 @@ def select(fn):
146
156
files += [(x , relpath (realpath (x ), sd )) for x in listfiles (sd ) if select (x )]
147
157
148
158
# create tar.gz of thoses files
149
- tf = tarfile .open (fn , 'w:gz' )
159
+ tf = tarfile .open (tfn , 'w:gz' )
150
160
dirs = []
151
161
for fn , afn in files :
162
+ print '%s: %s' % (tfn , fn )
152
163
dn = dirname (afn )
153
164
if dn not in dirs :
154
165
# create every dirs first if not exist yet
0 commit comments