3434 '^*.bzr/*' ,
3535 '^*.svn/*' ,
3636
37+ # pyc/py
38+ '*.pyc' ,
39+ '*.py' ,
40+
3741 # temp files
3842 '~' ,
39- '.bak' ,
40- '.swp' ,
43+ '* .bak' ,
44+ '* .swp' ,
4145]
4246
4347python_files = []
@@ -66,7 +70,8 @@ def compile_dir(dfn):
6670 '''
6771
6872 # -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 )
7075
7176def is_blacklist (name ):
7277 for pattern in BLACKLIST_PATTERNS :
@@ -127,14 +132,19 @@ def select(fn):
127132 zf .close ()
128133
129134
130- def make_tar (fn , source_dirs , ignore_path = []):
135+ def make_tar (tfn , source_dirs , ignore_path = []):
131136 '''
132137 Make a zip file `fn` from the contents of source_dis.
133138 '''
134139
135140 # selector function
136141 def select (fn ):
137142 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
138148 if rfn in python_files :
139149 return False
140150 return not is_blacklist (fn )
@@ -146,9 +156,10 @@ def select(fn):
146156 files += [(x , relpath (realpath (x ), sd )) for x in listfiles (sd ) if select (x )]
147157
148158 # create tar.gz of thoses files
149- tf = tarfile .open (fn , 'w:gz' )
159+ tf = tarfile .open (tfn , 'w:gz' )
150160 dirs = []
151161 for fn , afn in files :
162+ print '%s: %s' % (tfn , fn )
152163 dn = dirname (afn )
153164 if dn not in dirs :
154165 # create every dirs first if not exist yet
0 commit comments