MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / main

Function main

tools/python-3.11.9-amd64/Tools/scripts/pathfix.py:46–89  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

44
45
46def main():
47 global new_interpreter
48 global preserve_timestamps
49 global create_backup
50 global keep_flags
51 global add_flags
52
53 usage = ('usage: %s -i /interpreter -p -n -k -a file-or-directory ...\n' %
54 sys.argv[0])
55 try:
56 opts, args = getopt.getopt(sys.argv[1:], 'i:a:kpn')
57 except getopt.error as msg:
58 err(str(msg) + '\n')
59 err(usage)
60 sys.exit(2)
61 for o, a in opts:
62 if o == '-i':
63 new_interpreter = a.encode()
64 if o == '-p':
65 preserve_timestamps = True
66 if o == '-n':
67 create_backup = False
68 if o == '-k':
69 keep_flags = True
70 if o == '-a':
71 add_flags = a.encode()
72 if b' ' in add_flags:
73 err("-a option doesn't support whitespaces")
74 sys.exit(2)
75 if not new_interpreter or not new_interpreter.startswith(b'/') or \
76 not args:
77 err('-i option or file-or-directory missing\n')
78 err(usage)
79 sys.exit(2)
80 bad = 0
81 for arg in args:
82 if os.path.isdir(arg):
83 if recursedown(arg): bad = 1
84 elif os.path.islink(arg):
85 err(arg + ': will not process symbolic links\n')
86 bad = 1
87 else:
88 if fix(arg): bad = 1
89 sys.exit(bad)
90
91
92def ispython(name):

Callers 1

pathfix.pyFile · 0.70

Calls 8

strFunction · 0.85
startswithMethod · 0.80
recursedownFunction · 0.70
fixFunction · 0.70
getoptMethod · 0.45
exitMethod · 0.45
encodeMethod · 0.45
isdirMethod · 0.45

Tested by

no test coverage detected