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

Side by Side Diff: experimental/visual_studio_plugin/src/NaClVsx.Package/fixreg.py

Issue 10928195: First round of dead file removal (Closed) Base URL: https://github.com/samclegg/nativeclient-sdk.git@master
Patch Set: Created 8 years, 3 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
OLDNEW
(Empty)
1 #! -*- python -*-
2 #
3 # Copyright (c) 2011 The Native Client Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 """Fixes up the registry entries for the VSX plugin installed components
8 """
9
10 __author__ = 'mlinck@google.com (Michael Linck)'
11
12 import fileinput
13 import os.path
14 import shutil
15 import sys
16
17
18 def main(argv):
19 """Replaces absolute paths with a variable.
20
21 This script searches through the registry information file created for the
22 installer and replaces absolute paths with a tag that can be easily found and
23 overwritten at install time.
24
25 Besides replacing all the path pointing at bin\Debug (the CodeBase), it also
26 overwrites the path to the Templates directory. In the installed product
27 these should be the same. Note that this script is run only by the Visual
28 Studio Project itself and thus we assume we always get the correct input.
29
30 Unbeknownst to the caller, but to ensure that this script cannot cause any
31 regressions relative to the fixreg.pl script that it replaces, it also has to
32 replace the location of the windows system32 folder in case other machines
33 keep it somewhere else.
34
35 Args:
36 argv: The arguments passed to the script by the shell. We expect the
37 following arguments in the following order:
38 1. code_directory
39 2. old_registry_entry_file (The file generated by RegPkg.exe)
40 2. new_registry_entry_file (This script's output)
41 3. search_tag
42 """
43 code_base_string = argv[0].rstrip("\\ \n");
44 code_base_string = code_base_string.replace("\\", "\\\\")
45 search_tag = argv[3]
46 template_base_string = "%s\\\\..\\\\.." % search_tag
47 old_registry_info_file = argv[1];
48 new_registry_info_file = argv[2];
49
50 shutil.copy(old_registry_info_file, new_registry_info_file)
51 for line in fileinput.input(new_registry_info_file, inplace=1, mode='U'):
52 line = line.replace(code_base_string, search_tag)
53 line = line.replace(template_base_string, search_tag)
54 line = line.replace("/C:\\\\Windows\\\\system32\\\\", "[SystemFolder]")
55 sys.stdout.write(line)
56
57
58 if __name__ == '__main__':
59 main(sys.argv[1:])
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698