Skip to content

Commit 979d409

Browse files
committed
Add pyproject.toml
1 parent 647ada6 commit 979d409

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["setuptools>=51", "cython>=0.29", "wheel"]
3+
build-backend = "setuptools.build_meta"

setup.py

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,35 +42,28 @@ def build_extension(self, ext):
4242
if not isinstance(ext, IsalExtension):
4343
super().build_extension(ext)
4444
return
45-
# Import cython here because it should be installed by setup requires.
46-
from Cython.Build import cythonize
47-
cythonized_ext = cythonize(ext)[0]
48-
# _needs_stub is apparently not set elsewhere. It is not needed for
49-
# a functional isal extension.
50-
setattr(cythonized_ext, "_needs_stub", False)
51-
5245
# Check for isa-l include directories. This is useful when installing
5346
# in a conda environment.
5447
possible_prefixes = [sys.exec_prefix, sys.base_exec_prefix]
5548
for prefix in possible_prefixes:
5649
if os.path.exists(os.path.join(prefix, "include", "isa-l")):
57-
cythonized_ext.include_dirs = [
50+
ext.include_dirs = [
5851
os.path.join(prefix, "include")]
5952
break # Only one include directory is needed.
60-
cythonized_ext.libraries = ["isal"]
53+
ext.libraries = ["isal"]
6154
try: # First try to link dynamically
62-
super().build_extension(cythonized_ext)
55+
super().build_extension(ext)
6356
except CompileError:
6457
# Dynamic linking failed, build ISA-L and link statically.
65-
cythonized_ext.libraries = [] # Make sure libraries are empty
58+
ext.libraries = [] # Make sure libraries are empty
6659
isa_l_prefix_dir = build_isa_l()
67-
cythonized_ext.include_dirs = [os.path.join(isa_l_prefix_dir,
60+
ext.include_dirs = [os.path.join(isa_l_prefix_dir,
6861
"include")]
6962
# -fPIC needed for proper static linking
70-
cythonized_ext.extra_compile_args = ["-fPIC"]
71-
cythonized_ext.extra_objects = [
63+
ext.extra_compile_args = ["-fPIC"]
64+
ext.extra_objects = [
7265
os.path.join(isa_l_prefix_dir, "lib", "libisal.a")]
73-
super().build_extension(cythonized_ext)
66+
super().build_extension(ext)
7467

7568

7669
# Use a cache to prevent isa-l from being build twice. According to the
@@ -132,7 +125,6 @@ def build_isa_l():
132125
"License :: OSI Approved :: MIT License",
133126
],
134127
python_requires=">=3.6",
135-
setup_requires=["cython"],
136128
ext_modules=[
137129
IsalExtension("isal.isal_zlib", ["src/isal/isal_zlib.pyx"]),
138130
IsalExtension("isal._isal", ["src/isal/_isal.pyx"]),

0 commit comments

Comments
 (0)