|
22 | 22 | else: |
23 | 23 | # fall back to global installation |
24 | 24 | if platform.system() == "Darwin": |
25 | | - includedir = "/usr/local/include" |
| 25 | + includedirs = ["/usr/local/include"] |
26 | 26 | libdir = "/usr/local/lib" |
27 | 27 | else: |
28 | | - includedir = "." |
| 28 | + includedirs = ["."] |
29 | 29 | libdir = "." |
30 | 30 | libname = "libscip" if platform.system() == "Windows" else "scip" |
31 | 31 | print("Assuming that SCIP is installed globally, because SCIPOPTDIR is undefined.\n") |
|
34 | 34 |
|
35 | 35 | # check whether SCIP is installed in the given directory |
36 | 36 | if os.path.exists(os.path.join(scipoptdir, "include")): |
37 | | - includedir = os.path.abspath(os.path.join(scipoptdir, "include")) |
| 37 | + includedirs = [os.path.abspath(os.path.join(scipoptdir, "include"))] |
38 | 38 | else: |
39 | | - print(f"SCIPOPTDIR={scipoptdir} does not contain an include directory; searching for include files in src or ../src directory.") |
| 39 | + print("SCIPOPTDIR=%s does not contain an include directory; searching for include files in src or ../src directory.\n" % scipoptdir) |
40 | 40 |
|
41 | 41 | if os.path.exists(os.path.join(scipoptdir, "src")): |
42 | 42 | # SCIP seems to be installed in-place; check whether it was built using make or cmake |
43 | 43 | if os.path.exists(os.path.join(scipoptdir, "src", "scip")): |
44 | 44 | # assume that SCIPOPTDIR pointed to the main source directory (make) |
45 | | - includedir = os.path.abspath(os.path.join(scipoptdir, "src")) |
| 45 | + includedirs = [os.path.abspath(os.path.join(scipoptdir, "src")), os.path.abspath(os.path.join(scipoptdir, "lib/shared/include"))] |
46 | 46 | else: |
47 | 47 | # assume that SCIPOPTDIR pointed to a cmake build directory; try one level up (this is just a heuristic) |
48 | 48 | if os.path.exists(os.path.join(scipoptdir, "..", "src", "scip")): |
49 | | - includedir = os.path.abspath(os.path.join(scipoptdir, "..", "src")) |
| 49 | + includedirs = [os.path.abspath(os.path.join(scipoptdir, "..", "src"))] |
50 | 50 | else: |
51 | | - sys.exit(f"Could neither find src/scip nor ../src/scip directory in SCIPOPTDIR={scipoptdir}. Consider installing SCIP in a separate directory.") |
| 51 | + sys.exit("Could neither find src/scip nor ../src/scip directory in SCIPOPTDIR=%s. Consider installing SCIP in a separate directory." % scipoptdir) |
52 | 52 | else: |
53 | | - sys.exit(f"Could not find a src directory in SCIPOPTDIR={scipoptdir}; maybe it points to a wrong directory.") |
| 53 | + sys.exit("Could not find a src directory in SCIPOPTDIR=%s; maybe it points to a wrong directory." % scipoptdir) |
54 | 54 |
|
55 | 55 | # determine library |
56 | 56 | if os.path.exists(os.path.join(scipoptdir, "lib", "shared", "libscip.so")): |
57 | 57 | # SCIP seems to be created with make |
58 | 58 | libdir = os.path.abspath(os.path.join(scipoptdir, "lib", "shared")) |
59 | 59 | libname = "scip" |
60 | | - extra_compile_args.append("-DNO_CONFIG_HEADER") |
61 | | - # the following is a temporary hack to make it compile with SCIP/make: |
62 | | - extra_compile_args.append("-DTPI_NONE") # if other TPIs are used, please modify |
63 | 60 | else: |
64 | 61 | # assume that SCIP is installed on the system |
65 | 62 | libdir = os.path.abspath(os.path.join(scipoptdir, "lib")) |
66 | 63 | libname = "libscip" if platform.system() == "Windows" else "scip" |
67 | 64 |
|
68 | | - print(f"Using include path {includedir}.") |
69 | | - print(f"Using SCIP library {libname} at {libdir}.\n") |
| 65 | + print("Using include path %s." % includedirs) |
| 66 | + print("Using SCIP library %s at %s.\n" % (libname, libdir)) |
70 | 67 |
|
71 | 68 | # set runtime libraries |
72 | 69 | if platform.system() in ["Linux", "Darwin"]: |
|
96 | 93 |
|
97 | 94 | ext = ".pyx" if use_cython else ".c" |
98 | 95 |
|
99 | | - |
100 | 96 | on_github_actions = os.getenv('GITHUB_ACTIONS') == 'true' |
101 | 97 | release_mode = os.getenv('RELEASE') == 'true' |
102 | 98 | compile_with_line_tracing = on_github_actions and not release_mode |
103 | 99 |
|
104 | 100 | extensions = [ |
105 | 101 | Extension( |
106 | 102 | "pyscipopt.scip", |
107 | | - [os.path.join(packagedir, f"scip{ext}")], |
108 | | - include_dirs=[includedir], |
| 103 | + [os.path.join(packagedir, "scip%s" % ext)], |
| 104 | + include_dirs=includedirs, |
109 | 105 | library_dirs=[libdir], |
110 | 106 | libraries=[libname], |
111 | 107 | extra_compile_args=extra_compile_args, |
|
0 commit comments