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

Unified Diff: chrome/installer/util/prebuild/create_string_rc.py

Issue 8680018: Fix python scripts in src/chrome/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: copyright 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
« no previous file with comments | « chrome/common/net/PRESUBMIT.py ('k') | chrome/nacl/nacl_helper_bootstrap_munge_phdr.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/prebuild/create_string_rc.py
diff --git a/chrome/installer/util/prebuild/create_string_rc.py b/chrome/installer/util/prebuild/create_string_rc.py
index f3acdcd08e184ee4c399b0dcaa663723c3930012..9e4ddb78a84b8fbf2a6e6e92f26d8e98fc0c3f6a 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))
« no previous file with comments | « chrome/common/net/PRESUBMIT.py ('k') | chrome/nacl/nacl_helper_bootstrap_munge_phdr.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698