diff options
| author | shadchin <[email protected]> | 2022-02-10 16:44:39 +0300 |
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:44:39 +0300 |
| commit | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch) | |
| tree | 64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/tools/cython/Cython/Coverage.py | |
| parent | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'contrib/tools/cython/Cython/Coverage.py')
| -rw-r--r-- | contrib/tools/cython/Cython/Coverage.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/contrib/tools/cython/Cython/Coverage.py b/contrib/tools/cython/Cython/Coverage.py index e699cfe4f4e..5aa9df2ce08 100644 --- a/contrib/tools/cython/Cython/Coverage.py +++ b/contrib/tools/cython/Cython/Coverage.py @@ -33,14 +33,14 @@ def _find_c_source(base_path): return None -def _find_dep_file_path(main_file, file_path, relative_path_search=False): +def _find_dep_file_path(main_file, file_path, relative_path_search=False): abs_path = os.path.abspath(file_path) - if not os.path.exists(abs_path) and (file_path.endswith('.pxi') or - relative_path_search): - # files are looked up relative to the main source file - rel_file_path = os.path.join(os.path.dirname(main_file), file_path) - if os.path.exists(rel_file_path): - abs_path = os.path.abspath(rel_file_path) + if not os.path.exists(abs_path) and (file_path.endswith('.pxi') or + relative_path_search): + # files are looked up relative to the main source file + rel_file_path = os.path.join(os.path.dirname(main_file), file_path) + if os.path.exists(rel_file_path): + abs_path = os.path.abspath(rel_file_path) # search sys.path for external locations if a valid file hasn't been found if not os.path.exists(abs_path): for sys_path in sys.path: @@ -221,8 +221,8 @@ class Plugin(CoveragePlugin): self._c_files_map = {} for filename, code in code_lines.items(): - abs_path = _find_dep_file_path(c_file, filename, - relative_path_search=True) + abs_path = _find_dep_file_path(c_file, filename, + relative_path_search=True) self._c_files_map[abs_path] = (c_file, filename, code) if sourcefile not in self._c_files_map: |
