diff options
Diffstat (limited to 'contrib/fix_private-bin.py')
-rwxr-xr-x | contrib/fix_private-bin.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/contrib/fix_private-bin.py b/contrib/fix_private-bin.py index 270c758a2..86fd3d16b 100755 --- a/contrib/fix_private-bin.py +++ b/contrib/fix_private-bin.py | |||
@@ -36,18 +36,18 @@ def fixSymlinkedBins(files, replMap): | |||
36 | Used to add filenames to private-bin directives of files if the ones present are mentioned in replMap | 36 | Used to add filenames to private-bin directives of files if the ones present are mentioned in replMap |
37 | replMap is a dict where key is the marker filename and value is the filename to add | 37 | replMap is a dict where key is the marker filename and value is the filename to add |
38 | """ | 38 | """ |
39 | 39 | ||
40 | rxs=dict() | 40 | rxs=dict() |
41 | for (old,new) in replMap.items(): | 41 | for (old,new) in replMap.items(): |
42 | rxs[old]=re.compile("\\b"+old+"\\b") | 42 | rxs[old]=re.compile("\\b"+old+"\\b") |
43 | rxs[new]=re.compile("\\b"+new+"\\b") | 43 | rxs[new]=re.compile("\\b"+new+"\\b") |
44 | #print(rxs) | 44 | #print(rxs) |
45 | 45 | ||
46 | for filename in files: | 46 | for filename in files: |
47 | lines=None | 47 | lines=None |
48 | with open(filename,"r") as file: | 48 | with open(filename,"r") as file: |
49 | lines=file.readlines() | 49 | lines=file.readlines() |
50 | 50 | ||
51 | shouldUpdate=False | 51 | shouldUpdate=False |
52 | for (i,line) in enumerate(lines): | 52 | for (i,line) in enumerate(lines): |
53 | if privRx.search(line): | 53 | if privRx.search(line): |
@@ -56,7 +56,7 @@ def fixSymlinkedBins(files, replMap): | |||
56 | lines[i]=rxs[old].sub(old+","+new, line) | 56 | lines[i]=rxs[old].sub(old+","+new, line) |
57 | shouldUpdate=True | 57 | shouldUpdate=True |
58 | print(lines[i]) | 58 | print(lines[i]) |
59 | 59 | ||
60 | if shouldUpdate: | 60 | if shouldUpdate: |
61 | with open(filename,"w") as file: | 61 | with open(filename,"w") as file: |
62 | file.writelines(lines) | 62 | file.writelines(lines) |
@@ -132,7 +132,7 @@ def main(): | |||
132 | if len(sys.argv)>2 or (len(sys.argv)==2 and (sys.argv[1] == '-h' or sys.argv[1] == '--help') ): | 132 | if len(sys.argv)>2 or (len(sys.argv)==2 and (sys.argv[1] == '-h' or sys.argv[1] == '--help') ): |
133 | printHelp() | 133 | printHelp() |
134 | exit(1) | 134 | exit(1) |
135 | 135 | ||
136 | profilesPath=None | 136 | profilesPath=None |
137 | if len(sys.argv)==2: | 137 | if len(sys.argv)==2: |
138 | if os.path.isdir(sys.argv[1]): | 138 | if os.path.isdir(sys.argv[1]): |