Skip to content

Commit a2e9465

Browse files
committed
Fix windows zip-file creation
1 parent 54f148c commit a2e9465

File tree

1 file changed

+8
-42
lines changed

1 file changed

+8
-42
lines changed

utils.py

Lines changed: 8 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -221,54 +221,20 @@ def zip_files(zip_file_name, project_dir, *args, **kwargs):
221221
"""
222222
zip_file = zipfile.ZipFile(zip_file_name, 'w', config.ZIP_MODE)
223223
verbose = kwargs.pop('verbose', False)
224-
exclude_paths = kwargs.pop('exclude_paths', [])
225224
old_path = os.getcwd()
226225

227226
os.chdir(project_dir)
228227

229228
for arg in args:
230-
if is_windows():
231-
arg = '\\\\?\\'+os.path.abspath(arg).replace('/', '\\')
232229
if os.path.exists(arg):
233-
if os.path.isdir(arg):
234-
for root, dirs, files in os.walk(directory):
235-
excluded = False
236-
for exclude_path in exclude_paths:
237-
if exclude_path in path_join(directory,root):
238-
excluded = True
239-
if not excluded:
240-
for file in files:
241-
file_loc = os.path.relpath(path_join(root, file), directory)
242-
if verbose:
243-
log(file_loc)
244-
try:
245-
zip_file.write(file_loc)
246-
except ValueError:
247-
os.utime(file_loc, None)
248-
zip_file.write(file_loc)
249-
except FileNotFoundError:
250-
pass
251-
for direc in dirs:
252-
dir_loc = os.path.relpath(path_join(root, direc), directory)
253-
if verbose:
254-
log(dir_loc)
255-
try:
256-
zip_file.write(dir_loc)
257-
except ValueError:
258-
os.utime(file_loc, None)
259-
zip_file.write(file_loc)
260-
except FileNotFoundError:
261-
pass
262-
263-
else:
264-
file_loc = arg
265-
if verbose:
266-
log(file_loc)
267-
try:
268-
zip_file.write(file_loc)
269-
except ValueError:
270-
os.utime(file_loc, None)
271-
zip_file.write(file_loc)
230+
file_loc = arg
231+
if verbose:
232+
log(file_loc)
233+
try:
234+
zip_file.write(file_loc)
235+
except ValueError:
236+
os.utime(file_loc, None)
237+
zip_file.write(file_loc)
272238

273239
os.chdir(old_path)
274240

0 commit comments

Comments
 (0)