From a25b20494ef13695206e9e990ec8bf9d37312c29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Fri, 17 Jan 2025 17:31:35 +0100 Subject: [PATCH] feat: Add cmake & ninja build requirements only when needed Rather than listing `cmake` and `ninja` build requirements unconditionally, add them to `setup_requires` when they are necessary -- that is, when using skbuild and when the system installations of these tools are not available. This avoids installing the packages unnecessarily, and improves portability by using downstream patched CMake version when available. --- packages/vaex-core/pyproject.toml | 2 -- packages/vaex-core/setup.py | 6 ++++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/vaex-core/pyproject.toml b/packages/vaex-core/pyproject.toml index fa4386c41..cb3c5bddb 100644 --- a/packages/vaex-core/pyproject.toml +++ b/packages/vaex-core/pyproject.toml @@ -4,6 +4,4 @@ requires = [ "oldest-supported-numpy; python_version=='3.8'", # deprecated ref https://github.com/scipy/oldest-supported-numpy "numpy~=1.25; python_version>'3.8'", # numpy~=2.0 fails, backward compatible build-system as of v1.25 ref https://numpy.org/doc/2.1/dev/depending_on_numpy.html#build-time-dependency "scikit-build", - "cmake", - "ninja" ] diff --git a/packages/vaex-core/setup.py b/packages/vaex-core/setup.py index 05baecdb3..a5055149e 100644 --- a/packages/vaex-core/setup.py +++ b/packages/vaex-core/setup.py @@ -1,4 +1,5 @@ from setuptools import setup +import shutil import sys import os from importlib.machinery import SourceFileLoader @@ -25,6 +26,11 @@ url = "https://www.github.com/maartenbreddels/vaex" # TODO: after python2 supports frops, future and futures can also be dropped setup_requires = ["numpy~=1.17"] +if use_skbuild: + if not shutil.which("cmake"): + setup_requires += ["cmake"] + if not shutil.which("ninja"): + setup_requires += ["ninja"] install_requires_core = [ "numpy~=1.17", "aplus",