5
5
from cffi import FFI
6
6
from setuptools import Extension
7
7
8
- ###### TEST
9
- from pathlib import Path
10
-
11
- # prefix components:
12
- space = ' '
13
- branch = '│ '
14
- # pointers:
15
- tee = '├── '
16
- last = '└── '
17
-
18
-
19
- def tree (dir_path : Path , prefix : str = '' ):
20
- """A recursive generator, given a directory Path object
21
- will yield a visual tree structure line by line
22
- with each line prefixed by the same characters
23
- """
24
- contents = list (dir_path .iterdir ())
25
- # contents each get pointers that are ├── with a final └── :
26
- pointers = [tee ] * (len (contents ) - 1 ) + [last ]
27
- for pointer , path in zip (pointers , contents ):
28
- yield prefix + pointer + path .name
29
- if path .is_dir (): # extend the prefix and recurse:
30
- extension = branch if pointer == tee else space
31
- # i.e. space because last, └── , above so no more |
32
- yield from tree (path , prefix = prefix + extension )
33
- #####
34
-
35
8
is_win = sys .platform .startswith ("win" )
36
9
ss_g = Path (__file__ ).parent / "suitesparse_graphblas"
37
10
@@ -41,27 +14,12 @@ def tree(dir_path: Path, prefix: str=''):
41
14
# Expected subdirectories: include/ (contains GraphBLAS.h), lib/, and bin/ (on Windows only)
42
15
# Otherwise fallback to default system folders.
43
16
graphblas_root = os .environ .get ("GraphBLAS_ROOT" , None )
44
- if not graphblas_root :
45
- graphblas_root = os .environ .get ("GRAPHBLAS_PREFIX" , None )
46
-
47
- # if not graphblas_root:
48
- # graphblas_root = Path(__file__).parent
49
- #
50
- # if "{package}" in graphblas_root:
51
- # graphblas_root = graphblas_root.replace("{package}", str(Path(__file__).parent))
52
17
53
18
if not graphblas_root :
54
19
# Windows wheels.yml configures suitesparse.sh to install GraphBLAS to "C:\\GraphBLAS".
55
20
graphblas_root = "C:\\ GraphBLAS" if is_win else "/usr/local"
56
21
57
- include_dirs = [os .path .join (graphblas_root , "include" )]
58
- #### TEST
59
- # for i, line in enumerate(tree(Path(graphblas_root))):
60
- # print(line)
61
- # if i > 30:
62
- # break
63
- #### TEST
64
- include_dirs .append (os .path .join (graphblas_root , "include" , "suitesparse" ))
22
+ include_dirs = [os .path .join (graphblas_root , "include" ), os .path .join (graphblas_root , "include" , "suitesparse" )]
65
23
library_dirs = [os .path .join (graphblas_root , "lib" ), os .path .join (graphblas_root , "lib64" )]
66
24
if is_win :
67
25
include_dirs .append (os .path .join (sys .prefix , "Library" , "include" ))
@@ -113,7 +71,7 @@ def get_extension(apply_msvc_patch: bool = None, extra_compile_args=()):
113
71
msvc_code = msvc_code .replace ("double _Complex" , "_Dcomplex" )
114
72
code_path .write_text (msvc_code )
115
73
116
- # tell GraphBLAS.h that we need MSVC-style complex values
74
+ # Hack: tell GraphBLAS.h that we need MSVC-style complex values
117
75
extra_compile_args = list (extra_compile_args ) + ["-DGxB_HAVE_COMPLEX_MSVC" ]
118
76
119
77
return Extension (
0 commit comments