summaryrefslogtreecommitdiffstats
path: root/chrome/installer
diff options
context:
space:
mode:
authormaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-27 20:56:51 +0000
committermaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-27 20:56:51 +0000
commit2fac37585d3dfa0d7cf7a976698aae7627186573 (patch)
treed2f233a6afa5d8093f15f2f3c56cc4c009b05904 /chrome/installer
parent071302929ab813f647e51253af4e885b33eab463 (diff)
downloadchromium_src-2fac37585d3dfa0d7cf7a976698aae7627186573.zip
chromium_src-2fac37585d3dfa0d7cf7a976698aae7627186573.tar.gz
chromium_src-2fac37585d3dfa0d7cf7a976698aae7627186573.tar.bz2
Fix python scripts in src/chrome/
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. Minor python style fixes. TBR=nirnimesh@chromium.org BUG=105108 TEST= Review URL: http://codereview.chromium.org/8680018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111658 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer')
-rwxr-xr-xchrome/installer/util/prebuild/create_string_rc.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/chrome/installer/util/prebuild/create_string_rc.py b/chrome/installer/util/prebuild/create_string_rc.py
index f3acdcd..9e4ddb7 100755
--- a/chrome/installer/util/prebuild/create_string_rc.py
+++ b/chrome/installer/util/prebuild/create_string_rc.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
# 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.
@@ -76,6 +76,7 @@ kStringIds = [
# The ID of the first resource string.
kFirstResourceID = 1600
+
class TranslationStruct:
"""A helper struct that holds information about a single translation."""
def __init__(self, resource_id_str, language, translation):
@@ -152,6 +153,7 @@ def CollectTranslatedStrings(branding):
translated_strings.sort()
return translated_strings
+
def WriteRCFile(translated_strings, out_filename):
"""Writes a resource (rc) file with all the language strings provided in
|translated_strings|."""
@@ -177,6 +179,7 @@ def WriteRCFile(translated_strings, out_filename):
outfile.write(''.join(lines).encode('utf-16'))
outfile.close()
+
def WriteHeaderFile(translated_strings, out_filename):
"""Writes a .h file with resource ids. This file can be included by the
executable to refer to identifiers."""
@@ -219,7 +222,12 @@ def WriteHeaderFile(translated_strings, out_filename):
outfile.write('\n#endif // ndef RC_INVOKED\n')
outfile.close()
+
def main(argv):
+ # TODO: Use optparse to parse command line flags.
+ if len(argv) < 2:
+ print 'Usage:\n %s <output_directory> [branding]' % argv[0]
+ return 1
branding = ''
if (len(sys.argv) > 2):
branding = argv[2]
@@ -227,10 +235,8 @@ def main(argv):
kFilebase = os.path.join(argv[1], 'installer_util_strings')
WriteRCFile(translated_strings, kFilebase)
WriteHeaderFile(translated_strings, kFilebase)
+ return 0
+
if '__main__' == __name__:
- if len(sys.argv) < 2:
- print 'Usage:\n %s <output_directory> [branding]' % sys.argv[0]
- sys.exit(1)
- # Use optparse to parse command line flags.
- main(sys.argv)
+ sys.exit(main(sys.argv))