Skip to content

Commit 50c4973

Browse files
committed
improve code readability with detailed inline comments
1 parent 544501a commit 50c4973

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

_build_backend/backend.py

+4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
# This allows us to extend or override its functionality where needed
33
from setuptools import build_meta as _orig
44

5+
# Re-use the default implementations for standard PEP 517 hook methods
56
prepare_metadata_for_build_wheel = _orig.prepare_metadata_for_build_wheel
67
build_wheel = _orig.build_wheel
78
build_sdist = _orig.build_sdist
89
get_requires_for_build_sdist = _orig.get_requires_for_build_sdist
910

11+
# Override the `get_requires_for_build_wheel` function to add dynamic dependency logic
1012
def get_requires_for_build_wheel(config_settings=None):
1113
from packaging import version
1214
from skbuild.exceptions import SKBuildError
@@ -15,11 +17,13 @@ def get_requires_for_build_wheel(config_settings=None):
1517
# check if system cmake can be used if present
1618
# if not, append cmake PyPI distribution to required packages
1719
# scikit-build>=0.18 itself requires cmake 3.5+
20+
# Define the minimum required version of CMake (needed by scikit-build>=0.18)
1821
min_version = "3.5"
1922
try:
2023
if version.parse(get_cmake_version().split("-")[0]) < version.parse(min_version):
2124
packages.append(f'cmake>={min_version}')
2225
except SKBuildError:
2326
packages.append(f'cmake>={min_version}')
2427

28+
# Return the final list of required packages for building the wheel
2529
return packages

0 commit comments

Comments
 (0)