From a0af3989dbf7e6239b9a7d034731d7052f24b627 Mon Sep 17 00:00:00 2001 From: Talley Lambert <talley.lambert@gmail.com> Date: Sun, 8 Dec 2024 09:27:40 -0500 Subject: [PATCH] more debug --- setup.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/setup.py b/setup.py index f3b5d5c..c95fac6 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,4 @@ +import glob import os from ctypes import util from itertools import product @@ -6,6 +7,41 @@ from setuptools import setup from setuptools.extension import Extension +print("PATH:", os.environ["PATH"]) +print("CONDA_PREFIX:", os.environ.get("CONDA_PREFIX")) + + +def assert_gurobi_and_scip() -> None: + # Get the Conda environment prefix + conda_prefix = os.environ.get("CONDA_PREFIX") + if not conda_prefix: + raise RuntimeError("CONDA_PREFIX is not set. Ensure Conda is active in CI.") + + # Paths to check + gurobi_dll_path = os.path.join(conda_prefix, "Library", "bin", "gurobi*.dll") + scip_header_path = os.path.join( + conda_prefix, "Library", "include", "scip", "scipdefplugins.h" + ) + + # Verify Gurobi DLL + gurobi_found = any(os.path.exists(path) for path in glob.glob(gurobi_dll_path)) + if not gurobi_found: + raise FileNotFoundError( + f"Gurobi DLL not found in {gurobi_dll_path}. Ensure Gurobi is installed." + ) + + # Verify SCIP header + if not os.path.exists(scip_header_path): + raise FileNotFoundError( + f"SCIP header 'scipdefplugins.h' not found in {scip_header_path}. " + "Ensure SCIP is installed." + ) + + print("All required files are present.") + +if os.name == "nt": + assert_gurobi_and_scip() + # enable test coverage tracing if CYTHON_TRACE is set to a non-zero value CYTHON_TRACE = int(os.getenv("CYTHON_TRACE") in ("1", "True")) if not (CONDA_PREFIX := os.environ.get("CONDA_PREFIX")):