-
Notifications
You must be signed in to change notification settings - Fork 0
/
cython.patch
35 lines (33 loc) · 1.36 KB
/
cython.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
--- Coverage.py.backup 2024-05-06 15:17:09.336636857 +0100
+++ Coverage.py 2024-05-06 15:19:55.101376672 +0100
@@ -66,7 +66,19 @@ C_FILE_EXTENSIONS = ['.c', '.cpp', '.cc'
MODULE_FILE_EXTENSIONS = set(['.py', '.pyx', '.pxd'] + C_FILE_EXTENSIONS)
+def _find_in_dir(name, dirpath):
+ for root, dirs, files in os.walk(dirpath):
+ if name in files:
+ return os.path.join(root, name)
+
+
def _find_c_source(base_path):
+ if os.path.exists('build'):
+ pyxc_name = os.path.basename(base_path) + '.pyx.c'
+ cfile = _find_in_dir(pyxc_name, 'build')
+ if cfile is not None:
+ return cfile
+
file_exists = os.path.exists
for ext in C_FILE_EXTENSIONS:
file_name = base_path + ext
@@ -79,6 +91,12 @@ def _find_dep_file_path(main_file, file_
abs_path = os.path.abspath(file_path)
if not os.path.exists(abs_path) and (file_path.endswith('.pxi') or
relative_path_search):
+ src_path = os.path.join('src', file_path)
+ if os.path.exists(src_path):
+ abs_path = os.path.abspath(src_path)
+ cpath = canonical_filename(abs_path)
+ return cpath
+
# 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):