|
| 1 | +import glob |
1 | 2 | import os
|
2 | 3 | from ctypes import util
|
3 | 4 | from itertools import product
|
|
6 | 7 | from setuptools import setup
|
7 | 8 | from setuptools.extension import Extension
|
8 | 9 |
|
| 10 | +print("PATH:", os.environ["PATH"]) |
| 11 | +print("CONDA_PREFIX:", os.environ.get("CONDA_PREFIX")) |
| 12 | + |
| 13 | + |
| 14 | +def assert_gurobi_and_scip() -> None: |
| 15 | + # Get the Conda environment prefix |
| 16 | + conda_prefix = os.environ.get("CONDA_PREFIX") |
| 17 | + if not conda_prefix: |
| 18 | + raise RuntimeError("CONDA_PREFIX is not set. Ensure Conda is active in CI.") |
| 19 | + |
| 20 | + # Paths to check |
| 21 | + gurobi_dll_path = os.path.join(conda_prefix, "Library", "bin", "gurobi*.dll") |
| 22 | + scip_header_path = os.path.join( |
| 23 | + conda_prefix, "Library", "include", "scip", "scipdefplugins.h" |
| 24 | + ) |
| 25 | + |
| 26 | + # Verify Gurobi DLL |
| 27 | + gurobi_found = any(os.path.exists(path) for path in glob.glob(gurobi_dll_path)) |
| 28 | + if not gurobi_found: |
| 29 | + raise FileNotFoundError( |
| 30 | + f"Gurobi DLL not found in {gurobi_dll_path}. Ensure Gurobi is installed." |
| 31 | + ) |
| 32 | + |
| 33 | + # Verify SCIP header |
| 34 | + if not os.path.exists(scip_header_path): |
| 35 | + raise FileNotFoundError( |
| 36 | + f"SCIP header 'scipdefplugins.h' not found in {scip_header_path}. " |
| 37 | + "Ensure SCIP is installed." |
| 38 | + ) |
| 39 | + |
| 40 | + print("All required files are present.") |
| 41 | + |
| 42 | +if os.name == "nt": |
| 43 | + assert_gurobi_and_scip() |
| 44 | + |
9 | 45 | # enable test coverage tracing if CYTHON_TRACE is set to a non-zero value
|
10 | 46 | CYTHON_TRACE = int(os.getenv("CYTHON_TRACE") in ("1", "True"))
|
11 | 47 | if not (CONDA_PREFIX := os.environ.get("CONDA_PREFIX")):
|
|
0 commit comments