From 7a36360ffdf13c4c5b0be64d0053a4a9ef7ebc42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Fri, 17 Jan 2025 16:31:30 +0100 Subject: [PATCH] Add `cmake` dependency only if no system CMake is available Add a `cmake` dependency only when there is no system CMake install available. This avoids unnnecessarily installing a second copy of CMake on most systems, and increases compatibility with platforms that need downstream patching of CMake. --- pyproject.toml | 1 - setup.py | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 38c9c13..eaa2e5e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,6 @@ requires = [ "oldest-supported-numpy; python_version <= '3.8'", "setuptools>=49.5.0", "pybind11", - "cmake" ] build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index edb50ed..d530073 100644 --- a/setup.py +++ b/setup.py @@ -32,6 +32,9 @@ def __str__(self): import pybind11 return pybind11.get_include(self.user) +setup_requires = [] +if not sh.which("cmake"): + setup_requires += ["cmake"] cmake_args = [] # What variables from the environment do we wish to pass on to cmake as variables? @@ -119,6 +122,7 @@ def readme(): long_description_content_type='text/markdown', package_dir={'qdldl': 'module'}, include_package_data=True, # Include package data from MANIFEST.in + setup_requires=setup_requires, install_requires=["numpy >= 1.7", "scipy >= 0.13.2"], license='Apache 2.0', url="https://github.com/oxfordcontrol/qdldl-python/",