33# This source code is licensed under the MIT license found in the
44# LICENSE file in the root directory of this source tree.
55from distutils .errors import DistutilsModuleError
6+ import os
67from warnings import warn
78
89from setuptools import find_packages , setup
@@ -18,24 +19,31 @@ def has_ext_modules(self):
1819
1920class ExtBuildPy (build_py ):
2021 def run (self ):
21- # build_cmake needs to be called prior to build_py, as the latter
22- # collects the files output into the package directory.
23- try :
24- self .run_command ("build_cmake" )
25- except DistutilsModuleError :
26- warn (
27- "scikit-build-core not installed, CMake will not be invoked automatically. "
28- "Please install scikit-build-core or run CMake manually to build extensions."
29- )
22+ if os .environ .get ("BNB_SKIP_CMAKE" , "" ).lower () in ("1" , "true" , "yes" ):
23+ print ("skipping CMake build" )
24+ else :
25+ # build_cmake needs to be called prior to build_py, as the latter
26+ # collects the files output into the package directory.
27+ try :
28+ self .run_command ("build_cmake" )
29+ except DistutilsModuleError :
30+ warn (
31+ "scikit-build-core not installed, CMake will not be invoked automatically. "
32+ "Please install scikit-build-core or run CMake manually to build extensions."
33+ )
3034 super ().run ()
3135
3236
33- setup (
34- version = "0.49.0.dev0" ,
35- packages = find_packages (),
36- distclass = BinaryDistribution ,
37- cmake_source_dir = "." ,
38- cmdclass = {
39- "build_py" : ExtBuildPy ,
40- },
41- )
37+ cmdclass = {"build_py" : ExtBuildPy }
38+
39+ setup_kwargs = {
40+ "version" : "0.49.0.dev0" ,
41+ "packages" : find_packages (),
42+ "distclass" : BinaryDistribution ,
43+ "cmdclass" : {"build_py" : ExtBuildPy },
44+ }
45+
46+ if os .environ .get ("BNB_SKIP_CMAKE" , "" ).lower () not in ("1" , "true" , "yes" ):
47+ setup_kwargs ["cmake_source_dir" ] = "."
48+
49+ setup (** setup_kwargs )
0 commit comments