Chromium Code Reviews| Index: tools/export_tarball/export_tarball.py |
| diff --git a/tools/export_tarball/export_tarball.py b/tools/export_tarball/export_tarball.py |
| index 518d097c9db291e2a9774f6d1d362f2e77dc0557..41b77603f029e6bf13dfa7a75c8334e54480513b 100755 |
| --- a/tools/export_tarball/export_tarball.py |
| +++ b/tools/export_tarball/export_tarball.py |
| @@ -27,14 +27,10 @@ NONESSENTIAL_DIRS = ( |
| 'breakpad/src/processor/testdata', |
| 'chrome/browser/resources/tracing/tests', |
| 'chrome/common/extensions/docs', |
| - 'chrome/test/data', |
| 'chrome/tools/test/reference_build', |
| - 'content/test/data', |
| 'courgette/testdata', |
| 'data', |
| - 'media/test/data', |
| 'native_client/src/trusted/service_runtime/testdata', |
| - 'net/data', |
| 'src/chrome/test/data', |
| 'o3d/documentation', |
| 'o3d/samples', |
| @@ -71,6 +67,13 @@ NONESSENTIAL_DIRS = ( |
| 'webkit/tools/test/reference_build', |
| ) |
| +TESTDIRS = ( |
| + 'chrome/test/data', |
| + 'content/test/data', |
| + 'media/test/data', |
| + 'net/data', |
| +) |
| + |
| def GetSourceDirectory(): |
| return os.path.realpath( |
| @@ -96,7 +99,7 @@ class MyTarFile(tarfile.TarFile): |
| # Remove contents of non-essential directories, but preserve gyp files, |
| # so that build/gyp_chromium can work. |
| - for nonessential_dir in NONESSENTIAL_DIRS: |
| + for nonessential_dir in (NONESSENTIAL_DIRS + TESTDIRS): |
| dir_path = os.path.join(GetSourceDirectory(), nonessential_dir) |
| if (name.startswith(dir_path) and |
| os.path.isfile(name) and |
| @@ -108,9 +111,11 @@ class MyTarFile(tarfile.TarFile): |
| def main(argv): |
| parser = optparse.OptionParser() |
| + parser.add_option("--basename") |
| parser.add_option("--remove-nonessential-files", |
| dest="remove_nonessential_files", |
| action="store_true", default=False) |
| + parser.add_option("--test-data", action="store_true") |
| parser.add_option("--xz", action="store_true") |
| options, args = parser.parse_args(argv) |
| @@ -121,7 +126,7 @@ def main(argv): |
| return 1 |
| if not os.path.exists(GetSourceDirectory()): |
| - print 'Cannot find the src directory.' |
| + print 'Cannot find the src directory ' + GetSourceDirectory() |
| return 1 |
| # This command is from src/DEPS; please keep them in sync. |
| @@ -135,7 +140,10 @@ def main(argv): |
| else: |
| output_fullname = args[0] + '.tar.bz2' |
| - output_basename = os.path.basename(args[0]) |
| + if options.basename: |
|
M-A Ruel
2013/03/08 02:10:54
output_basename = options.basename or os.path.base
Paweł Hajdan Jr.
2013/03/08 18:00:38
Done.
|
| + output_basename = options.basename |
| + else: |
| + output_basename = os.path.basename(args[0]) |
| if options.xz: |
| archive = MyTarFile.open(output_fullname, 'w') |
| @@ -143,7 +151,12 @@ def main(argv): |
| archive = MyTarFile.open(output_fullname, 'w:bz2') |
| archive.set_remove_nonessential_files(options.remove_nonessential_files) |
| try: |
| - archive.add(GetSourceDirectory(), arcname=output_basename) |
| + if (options.test_data): |
|
M-A Ruel
2013/03/08 02:10:54
if options.test_data:
Paweł Hajdan Jr.
2013/03/08 18:00:38
Done. Heh, too much C++.
|
| + for directory in TESTDIRS: |
| + archive.add(os.path.join(GetSourceDirectory(), directory), |
| + arcname=os.path.join(output_basename, directory)) |
| + else: |
| + archive.add(GetSourceDirectory(), arcname=output_basename) |
| finally: |
| archive.close() |