Skip to content

Commit 9056009

Browse files
committed
- only add cmake / swig if not in the path
1 parent 6c1f74d commit 9056009

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

setup.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,15 @@ def get_dir_if_exists(variable, default):
139139
if not exists('libsbml'):
140140
makedirs('libsbml')
141141

142+
SETUP_REQUIRES = []
143+
# test whether cmake is in the PATH
144+
if shutil.which('cmake') is None:
145+
SETUP_REQUIRES.append('cmake')
146+
147+
# test whether swig is in the PATH
148+
if shutil.which('swig') is None:
149+
SETUP_REQUIRES.append('swig')
150+
142151

143152
class CMakeExtension(Extension):
144153
"""Override the default setuptools extension building."""
@@ -355,6 +364,6 @@ def build_cmake(self, extension):
355364
cmdclass={
356365
'build_ext': CMakeBuild,
357366
},
358-
setup_requires=['cmake', 'swig']
367+
setup_requires=SETUP_REQUIRES
359368
)
360369

0 commit comments

Comments
 (0)