summaryrefslogtreecommitdiffstats
path: root/build/extract_from_cab.py
diff options
context:
space:
mode:
authormaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-23 19:13:44 +0000
committermaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-23 19:13:44 +0000
commit3f09d180c4d21f9c74689d23d796aed490661182 (patch)
tree9afdc2584b229bba954fc4fc307d20599005ef7f /build/extract_from_cab.py
parentf44725cf38e0f25a54a5cdeef699c11c9562b2d9 (diff)
downloadchromium_src-3f09d180c4d21f9c74689d23d796aed490661182.zip
chromium_src-3f09d180c4d21f9c74689d23d796aed490661182.tar.gz
chromium_src-3f09d180c4d21f9c74689d23d796aed490661182.tar.bz2
Fix python scripts in src/build/
Make sure that: - shebang is only present for executable files - shebang is #!/usr/bin/env python - __main__ is only present for executable files - file's executable bit is coherent Also fix EOF LF to be only one. TBR=michaelbai@chromium.org BUG=105108 TEST= Review URL: http://codereview.chromium.org/8667008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111385 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build/extract_from_cab.py')
-rwxr-xr-x[-rw-r--r--]build/extract_from_cab.py38
1 files changed, 23 insertions, 15 deletions
diff --git a/build/extract_from_cab.py b/build/extract_from_cab.py
index fd99184..9320462 100644..100755
--- a/build/extract_from_cab.py
+++ b/build/extract_from_cab.py
@@ -1,27 +1,35 @@
#!/usr/bin/env python
-# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-# Extracts a single file from a CAB archive.
+"""Extracts a single file from a CAB archive."""
import os
import subprocess
import sys
-if len(sys.argv) != 4:
- print 'Usage: extract_from_cab.py cab_path archived_file output_dir'
- sys.exit(1)
-[cab_path, archived_file, output_dir] = sys.argv[1:]
+def main():
+ if len(sys.argv) != 4:
+ print 'Usage: extract_from_cab.py cab_path archived_file output_dir'
+ return 1
-# Invoke the Windows expand utility to extract the file.
-level = subprocess.call(['expand', cab_path, '-F:' + archived_file, output_dir])
-if level != 0:
- sys.exit(level)
+ [cab_path, archived_file, output_dir] = sys.argv[1:]
-# The expand utility preserves the modification date and time of the archived
-# file. Touch the extracted file. This helps build systems that compare the
-# modification times of input and output files to determine whether to do an
-# action.
-os.utime(os.path.join(output_dir, archived_file), None)
+ # Invoke the Windows expand utility to extract the file.
+ level = subprocess.call(
+ ['expand', cab_path, '-F:' + archived_file, output_dir])
+ if level != 0:
+ return level
+
+ # The expand utility preserves the modification date and time of the archived
+ # file. Touch the extracted file. This helps build systems that compare the
+ # modification times of input and output files to determine whether to do an
+ # action.
+ os.utime(os.path.join(output_dir, archived_file), None)
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(main())