Index: tools/export_tarball/export_tarball.py |
diff --git a/tools/export_tarball/export_tarball.py b/tools/export_tarball/export_tarball.py |
index 607f478f8810b4e7db11a9e83e4f5129c1b42009..6715f110fb92d43108150e4cfe32c8524f4ab23c 100644 |
--- a/tools/export_tarball/export_tarball.py |
+++ b/tools/export_tarball/export_tarball.py |
@@ -16,9 +16,6 @@ export_tarball.py /foo/bar |
The above will create file /foo/bar.tar.bz2. |
""" |
-from __future__ import with_statement |
- |
-import contextlib |
import optparse |
import os |
import sys |
@@ -74,9 +71,12 @@ def main(argv): |
return False |
- with contextlib.closing(tarfile.open(output_fullname, 'w:bz2')) as archive: |
+ archive = tarfile.open(output_fullname, 'w:bz2') |
+ try: |
archive.add(GetSourceDirectory(), arcname=output_basename, |
exclude=ShouldExcludePath) |
+ finally: |
+ archive.close() |
return 0 |