Skip to content

Commit a352121

Browse files
committed
Add explicit setup requirement for scikit-build
Fallback to setuptools when scikit-build is not available to allow the egg_info command to specify the requirements to run setup.py. This allows source distribution to specify that they require scikit-build. Also adding an error message when neither tool is available.
1 parent 3601602 commit a352121

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

MANIFEST.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
include CMakeLists.txt
2+
include README.md
3+
include setup.py
4+
include requirements.txt
5+
graft SimpleITK
6+
prune SimpleITK/.ExternalData
7+
prune _skbuild

setup.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1-
from skbuild import setup
1+
try:
2+
from skbuild import setup
3+
except ImportError:
4+
try:
5+
from setuptools import setup
6+
except ImportError:
7+
print('setuptools or scikit-build is required to build from source.', file=sys.stderr)
8+
print('Please run:\n', file=sys.stderr)
9+
print(' python -m pip install setuptools')
10+
sys.exit(1)
11+
12+
213

314
setup(
415
name='SimpleITK',
@@ -22,6 +33,6 @@
2233
license='Apache',
2334
keywords='ITK InsightToolkit segmentation registration image',
2435
url=r'http://simpleitk.org/',
25-
install_requires=[
26-
]
36+
install_requires=[],
37+
setup_requires=['scikit-build>=0.5']
2738
)

0 commit comments

Comments
 (0)