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

Unified Diff: tools/export_tarball/export_tarball.py

Issue 603008: Workaround older python versions' less capable tarfile. (Closed)
Patch Set: Created 10 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/export_tarball/export_tarball.py
diff --git a/tools/export_tarball/export_tarball.py b/tools/export_tarball/export_tarball.py
index 6715f110fb92d43108150e4cfe32c8524f4ab23c..9c356f82094bf677b32d06f4e00af385d3f56507 100644
--- a/tools/export_tarball/export_tarball.py
+++ b/tools/export_tarball/export_tarball.py
@@ -38,6 +38,14 @@ def GetSourceDirectory():
return os.path.realpath(
os.path.join(os.path.dirname(__file__), '..', '..', '..', 'src'))
+# Workaround lack of the exclude parameter in add method in python-2.4.
+# TODO(phajdan.jr): remove the workaround when it's not needed on the bot.
+class MyTarFile(tarfile.TarFile):
+ def add(self, name, arcname=None, recursive=True, exclude=None):
+ if exclude is not None and exclude(name):
+ return
+ tarfile.TarFile.add(self, name, arcname=arcname, recursive=recursive)
+
def main(argv):
parser = optparse.OptionParser()
parser.add_option("--remove-nonessential-files",
@@ -71,7 +79,7 @@ def main(argv):
return False
- archive = tarfile.open(output_fullname, 'w:bz2')
+ archive = MyTarFile.open(output_fullname, 'w:bz2')
try:
archive.add(GetSourceDirectory(), arcname=output_basename,
exclude=ShouldExcludePath)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698