diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-13 18:24:56 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-13 18:24:56 +0000 |
commit | 81770e7b9aea44bc43f414dbc02b155138f5bfe8 (patch) | |
tree | e4d54d0a733c33a789c90b7a685ec0537c9531da | |
parent | e1a211380c1d146490aa0b37f63d07cb5916604b (diff) | |
download | chromium_src-81770e7b9aea44bc43f414dbc02b155138f5bfe8.zip chromium_src-81770e7b9aea44bc43f414dbc02b155138f5bfe8.tar.gz chromium_src-81770e7b9aea44bc43f414dbc02b155138f5bfe8.tar.bz2 |
Merge 38756 - Workaround older python versions' less capable tarfile.
TEST=none
BUG=29044
Review URL: http://codereview.chromium.org/603008
TBR=nsylvain@chromium.org
Review URL: http://codereview.chromium.org/600121
git-svn-id: svn://svn.chromium.org/chrome/branches/307/src@39019 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | tools/export_tarball/export_tarball.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/export_tarball/export_tarball.py b/tools/export_tarball/export_tarball.py index 6715f11..9c356f8 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) |