Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Unified Diff: chrome/tools/build/win/make_zip_with_relative_entries.py

Issue 6969064: Start generating translated policy templates (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: activate translations for mac Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/tools/build/win/make_zip_with_relative_entries.py
diff --git a/chrome/tools/build/win/make_zip_with_relative_entries.py b/chrome/tools/build/win/make_zip_with_relative_entries.py
deleted file mode 100644
index 4df554e3eb49cde6fd11a1fa7c2748ac414abe62..0000000000000000000000000000000000000000
--- a/chrome/tools/build/win/make_zip_with_relative_entries.py
+++ /dev/null
@@ -1,63 +0,0 @@
-# Copyright (c) 2010 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Creates a zip archive with relative entry paths, from a list of files with
-absolute paths.
-"""
-
-import sys
-import zipfile
-
-def add_files_to_zip(zip_file, base_dir, files):
- """Pack a list of files into a zip archive, that is already
- opened for writing.
-
- Args:
- zip_file: An object representing the zip archive.
- base_dir: A path that will be stripped from the beginning of the paths of
- added files.
- files: The list of file paths to add.
- """
- prefix_len = len(base_dir)
-
- for file_path in files:
- if not file_path.startswith(base_dir):
- print "All the input files should be in the base directory."
- return 1
- entry_path = file_path[prefix_len:]
- zip_file.write(file_path, entry_path)
-
- return 0
-
-
-def main(zip_path, base_dir, files):
- """Pack a list of files into a zip archive.
-
- Args:
- zip_path: The file name of the zip archive.
- base_dir: A path that will be stripped from the beginning of the paths of
- added files.
- files: The list of file paths to add.
-
- Example:
- main('x.zip', '/a/b', ['/a/b/c/1.txt', '/a/b/d/2.txt'])
- Will put the following entries to x.zip:
- c/1.txt
- d/2.txt
- """
- if (base_dir[-1] != '/'):
- base_dir = base_dir + '/'
-
- zip_file = zipfile.ZipFile(zip_path, 'w', zipfile.ZIP_DEFLATED)
- try:
- return add_files_to_zip(zip_file, base_dir, files)
- finally:
- zip_file.close()
-
-if '__main__' == __name__:
- if len(sys.argv) < 4:
- print "usage: %s output.zip path/to/base/dir list of files" % sys.argv[0]
- sys.exit(1)
-
- sys.exit(main(sys.argv[1], sys.argv[2], sys.argv[3:]))

Powered by Google App Engine
This is Rietveld 408576698