Skip to content

Commit ffec7b5

Browse files
authored
Update pre-commit and extract a function (#43)
* Update build script * Pre-commit changes
1 parent 127bdfb commit ffec7b5

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ci:
44

55
repos:
66
- repo: https://github.com/astral-sh/ruff-pre-commit
7-
rev: "v0.1.3"
7+
rev: "v0.11.9"
88
hooks:
99
- id: ruff
1010
args: [--fix, --show-fixes]

install_KLU_Sundials.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,19 @@ def install_suitesparse(download_dir):
6060
# if in CI, set RPATH to the install directory for SuiteSparse_config
6161
# dylibs to find libomp.dylib when repairing the wheel
6262
if os.environ.get("CIBUILDWHEEL") == "1":
63-
env[
64-
"CMAKE_OPTIONS"
65-
] = f"-DCMAKE_INSTALL_PREFIX={install_dir} -DCMAKE_INSTALL_RPATH={install_dir}/lib"
63+
env["CMAKE_OPTIONS"] = (
64+
f"-DCMAKE_INSTALL_PREFIX={install_dir} -DCMAKE_INSTALL_RPATH={install_dir}/lib"
65+
)
6666
else:
6767
env["CMAKE_OPTIONS"] = f"-DCMAKE_INSTALL_PREFIX={install_dir}"
6868
else:
6969
# For AMD, COLAMD, BTF and KLU; do not set a BUILD RPATH but use an
7070
# INSTALL RPATH in order to ensure that the dynamic libraries are found
7171
# at runtime just once. Otherwise, delocate complains about multiple
7272
# references to the SuiteSparse_config dynamic library (auditwheel does not).
73-
env[
74-
"CMAKE_OPTIONS"
75-
] = f"-DCMAKE_INSTALL_PREFIX={install_dir} -DCMAKE_INSTALL_RPATH={install_dir}/lib -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=FALSE -DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE"
73+
env["CMAKE_OPTIONS"] = (
74+
f"-DCMAKE_INSTALL_PREFIX={install_dir} -DCMAKE_INSTALL_RPATH={install_dir}/lib -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=FALSE -DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE"
75+
)
7676
subprocess.run(make_cmd, cwd=build_dir, env=env, shell=True, check=True)
7777
subprocess.run(install_cmd, cwd=build_dir, check=True)
7878

@@ -269,14 +269,7 @@ def parallel_download(urls, download_dir):
269269
future.result()
270270

271271
# First check requirements: make and cmake
272-
try:
273-
subprocess.run(["make", "--version"])
274-
except OSError as error:
275-
raise RuntimeError("Make must be installed.") from error
276-
try:
277-
subprocess.run(["cmake", "--version"])
278-
except OSError as error:
279-
raise RuntimeError("CMake must be installed.") from error
272+
check_build_tools()
280273

281274
# Build in parallel wherever possible
282275
os.environ["CMAKE_BUILD_PARALLEL_LEVEL"] = str(cpu_count())
@@ -341,5 +334,16 @@ def parallel_download(urls, download_dir):
341334
install_suitesparse(download_dir)
342335

343336

337+
def check_build_tools():
338+
try:
339+
subprocess.run(["make", "--version"])
340+
except OSError as error:
341+
raise RuntimeError("Make must be installed.") from error
342+
try:
343+
subprocess.run(["cmake", "--version"])
344+
except OSError as error:
345+
raise RuntimeError("CMake must be installed.") from error
346+
347+
344348
if __name__ == "__main__":
345349
build_solvers()

0 commit comments

Comments
 (0)