DebugClients/Python/coverage/files.py

changeset 4490
3f58261e7bb1
parent 4489
d0d6e4ad31bd
child 5051
3586ebd9fac8
equal deleted inserted replaced
4489:d0d6e4ad31bd 4490:3f58261e7bb1
56 if filename not in CANONICAL_FILENAME_CACHE: 56 if filename not in CANONICAL_FILENAME_CACHE:
57 if not os.path.isabs(filename): 57 if not os.path.isabs(filename):
58 for path in [os.curdir] + sys.path: 58 for path in [os.curdir] + sys.path:
59 if path is None: 59 if path is None:
60 continue 60 continue
61 f = os.path.join(path, filename) 61 f = path + os.sep + filename
62 if os.path.exists(f): 62 if os.path.exists(f):
63 filename = f 63 filename = f
64 break 64 break
65 cf = abs_file(filename) 65 cf = abs_file(filename)
66 CANONICAL_FILENAME_CACHE[filename] = cf 66 CANONICAL_FILENAME_CACHE[filename] = cf
112 normtail = os.path.normcase(tail) 112 normtail = os.path.normcase(tail)
113 for f in files: 113 for f in files:
114 if os.path.normcase(f) == normtail: 114 if os.path.normcase(f) == normtail:
115 tail = f 115 tail = f
116 break 116 break
117 actpath = os.path.join(head, tail) 117 actpath = head.strip(os.sep) + os.sep + tail
118 _ACTUAL_PATH_CACHE[path] = actpath 118 _ACTUAL_PATH_CACHE[path] = actpath
119 return actpath 119 return actpath
120 120
121 else: 121 else:
122 def actual_path(filename): 122 def actual_path(filename):
347 for filename in filenames: 347 for filename in filenames:
348 # We're only interested in files that look like reasonable Python 348 # We're only interested in files that look like reasonable Python
349 # files: Must end with .py or .pyw, and must not have certain funny 349 # files: Must end with .py or .pyw, and must not have certain funny
350 # characters that probably mean they are editor junk. 350 # characters that probably mean they are editor junk.
351 if re.match(r"^[^.#~!$@%^&*()+=,]+\.pyw?$", filename): 351 if re.match(r"^[^.#~!$@%^&*()+=,]+\.pyw?$", filename):
352 yield os.path.join(dirpath, filename) 352 yield dirpath + os.sep + filename
353
354 #
355 # eflag: FileType = Python2

eric ide

mercurial