Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6792)

Unified Diff: build/extract_from_cab.py

Issue 8667008: Fix python scripts in src/build/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: build/extract_from_cab.py
diff --git a/build/extract_from_cab.py b/build/extract_from_cab.py
old mode 100644
new mode 100755
index fd9918456cce8d153732c9e15790391577fb1799..932046267fdec8ffc79aa0b996dd781203875ae8
--- 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())

Powered by Google App Engine
This is Rietveld 408576698