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

Side by Side Diff: clickonce/add_trusturlparams.py

Issue 624713003: Keep only base/extractor.[cc|h]. (Closed) Base URL: https://chromium.googlesource.com/external/omaha.git@master
Patch Set: Created 6 years, 2 months 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 unified diff | Download patch
« no previous file with comments | « build.scons ('k') | clickonce/build.scons » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/python2.4
2 #
3 # Copyright 2008-2009 Google Inc.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 # ========================================================================
17
18 """
19 mage.exe does not provide a way to add the trustURLParameters attribute to an
20 application manifest. This script fills that gap. It also adds in the
21 localized display name, to get around issues with the Python commands
22 module.
23 """
24
25 import sys
26 import os
27 import getopt
28 import commands
29
30
31 def _AddTrustURLParametersAndName(manifest_file, output_file, display_name):
32 f_in = open(manifest_file, 'r')
33 manifest_contents = f_in.read()
34 f_in.close()
35
36 manifest_contents = manifest_contents.replace('<deployment ', \
37 '<deployment trustURLParameters="true" ')
38 manifest_contents = manifest_contents.replace('\"xxxXXXxxx', \
39 '\"%s' % display_name)
40
41 f_out = open(output_file, 'w')
42 # Works without needing to write the codecs.BOM_UTF8 at the beginning of the
43 # file. May need to write this at some point though.
44 f_out.write(manifest_contents)
45 f_out.close()
46
47
48 def _Usage():
49 """Prints out script usage information."""
50 print """
51 add_trusturlparams.py: Modify the given manifest file by adding in a
52 trustURLParameters=true to the deployment section. Also substitutes
53 the dummy name xxxXXXxxx with the localized display name.
54
55 Usage:
56 add_trusturlparams.py [--help
57 | --manifest_file filename
58 | --output_file filename
59 --display_name {i18n display name}]
60
61 Options:
62 --help Show this information.
63 --manifest_file filename Path/name of input/output manifest file.
64 --output_file filename Path/name of an optional output manifest file.
65 --display_name name i18n display name.
66 """
67
68
69 def _Main():
70 # use getopt to parse the option and argument list; this may raise, but
71 # don't catch it
72 _ARGUMENT_LIST = ["help", "manifest_file=", "output_file=", "display_name="]
73 (opts, args) = getopt.getopt(sys.argv[1:], "", _ARGUMENT_LIST)
74 if not opts or ("--help", "") in opts:
75 _Usage()
76 sys.exit()
77
78 manifest_file = ""
79 output_file = ""
80 display_name = ""
81
82 for (o, v) in opts:
83 if o == "--manifest_file":
84 manifest_file = v
85 if o == "--output_file":
86 output_file = v
87 if o == "--display_name":
88 display_name = v
89
90 # make sure we have work to do
91 if not manifest_file:
92 raise SystemExit("no manifest_filename specified")
93 if not display_name:
94 raise SystemExit("no display_name specified")
95
96 # overwrite existing file if no separate output specified
97 if not output_file:
98 output_file = manifest_file
99
100 _AddTrustURLParametersAndName(manifest_file, output_file, display_name)
101 sys.exit()
102
103
104 if __name__ == "__main__":
105 _Main()
106
OLDNEW
« no previous file with comments | « build.scons ('k') | clickonce/build.scons » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698