OLD | NEW |
1 # Copyright (c) 2010 Google Inc. All rights reserved. | 1 # Copyright (c) 2010 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 # zip_file = ZipFile(zip_path, 'w') | 61 # zip_file = ZipFile(zip_path, 'w') |
62 # for root, dirs, files in os.walk(source_path): | 62 # for root, dirs, files in os.walk(source_path): |
63 # for path in files: | 63 # for path in files: |
64 # absolute_path = os.path.join(root, path) | 64 # absolute_path = os.path.join(root, path) |
65 # zip_file.write(os.path.relpath(path, source_path)) | 65 # zip_file.write(os.path.relpath(path, source_path)) |
66 # However, getting the paths, encoding and compression correct could be
non-trivial. | 66 # However, getting the paths, encoding and compression correct could be
non-trivial. |
67 # So, for now we depend on the environment having "zip" installed (likel
y fails on Win32) | 67 # So, for now we depend on the environment having "zip" installed (likel
y fails on Win32) |
68 try: | 68 try: |
69 self._executive.run_command(['zip', '-9', '-r', zip_path, '.'], cwd=
source_path) | 69 self._executive.run_command(['zip', '-9', '-r', zip_path, '.'], cwd=
source_path) |
70 except ScriptError as e: | 70 except ScriptError as e: |
71 _log.error("Workspace.create_zip failed in %s:\n%s" % (source_path,
e.message_with_output())) | 71 _log.error("Workspace.create_zip failed in %s:\n%s", source_path, e.
message_with_output()) |
72 return None | 72 return None |
73 | 73 |
74 return zip_class(zip_path) | 74 return zip_class(zip_path) |
OLD | NEW |