OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """ | 6 """ |
7 This tool creates a tarball with all the sources, but without .svn directories. | 7 This tool creates a tarball with all the sources, but without .svn directories. |
8 | 8 |
9 It can also remove files which are not strictly required for build, so that | 9 It can also remove files which are not strictly required for build, so that |
10 the resulting tarball can be reasonably small (last time it was ~110 MB). | 10 the resulting tarball can be reasonably small (last time it was ~110 MB). |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
94 | 94 |
95 if len(args) != 1: | 95 if len(args) != 1: |
96 print 'You must provide only one argument: output file name' | 96 print 'You must provide only one argument: output file name' |
97 print '(without .tar.bz2 extension).' | 97 print '(without .tar.bz2 extension).' |
98 return 1 | 98 return 1 |
99 | 99 |
100 if not os.path.exists(GetSourceDirectory()): | 100 if not os.path.exists(GetSourceDirectory()): |
101 print 'Cannot find the src directory.' | 101 print 'Cannot find the src directory.' |
102 return 1 | 102 return 1 |
103 | 103 |
104 if subprocess.call(['python', 'build/util/lastchange.py', '-o', | |
Paweł Hajdan Jr.
2012/05/25 18:49:35
This is introducing code duplication. I appreciate
| |
105 'build/util/LASTCHANGE'], cwd=GetSourceDirectory()) != 0: | |
106 print 'Could not run build/util/lastchange.py to update LASTCHANGE.' | |
107 return 1 | |
108 | |
104 output_fullname = args[0] + '.tar.bz2' | 109 output_fullname = args[0] + '.tar.bz2' |
105 output_basename = os.path.basename(args[0]) | 110 output_basename = os.path.basename(args[0]) |
106 | 111 |
107 archive = MyTarFile.open(output_fullname, 'w:bz2') | 112 archive = MyTarFile.open(output_fullname, 'w:bz2') |
108 archive.set_remove_nonessential_files(options.remove_nonessential_files) | 113 archive.set_remove_nonessential_files(options.remove_nonessential_files) |
109 try: | 114 try: |
110 archive.add(GetSourceDirectory(), arcname=output_basename) | 115 archive.add(GetSourceDirectory(), arcname=output_basename) |
111 finally: | 116 finally: |
112 archive.close() | 117 archive.close() |
113 | 118 |
114 return 0 | 119 return 0 |
115 | 120 |
116 | 121 |
117 if __name__ == "__main__": | 122 if __name__ == "__main__": |
118 sys.exit(main(sys.argv[1:])) | 123 sys.exit(main(sys.argv[1:])) |
OLD | NEW |