Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
do not install cython as build dependency
  • Loading branch information
methane committed May 7, 2024
commit 08e52ab9e4a9c4c98aa3d8a0dbe3721edbb2dbb0
6 changes: 1 addition & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
[build-system]
requires = [
# Also declared in requirements.txt, if updating here please also update there
"Cython~=3.0.10",
"setuptools >= 69.5.1",
]
requires = ["setuptools >= 69.5.1"]
build-backend = "setuptools.build_meta"

[project]
Expand Down
43 changes: 0 additions & 43 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,47 +8,6 @@

PYPY = hasattr(sys, "pypy_version_info")


class NoCython(Exception):
pass


try:
import Cython.Compiler.Main as cython_compiler

have_cython = True
except ImportError:
have_cython = False


def cythonize(src):
if not have_cython:
raise Exception("Cython is required for building from checkout")
sys.stderr.write(f"cythonize: {src!r}\n")
cython_compiler.compile([src])


def ensure_source(src):
pyx = os.path.splitext(src)[0] + ".pyx"

if not os.path.exists(src) or have_cython and os.stat(src).st_mtime < os.stat(pyx).st_mtime:
cythonize(pyx)


class BuildExt(build_ext):
def build_extension(self, ext):
for src in ext.sources:
ensure_source(src)
return build_ext.build_extension(self, ext)


# Cython is required for sdist
class Sdist(sdist):
def __init__(self, *args, **kwargs):
cythonize("msgpack/_cmsgpack.pyx")
sdist.__init__(self, *args, **kwargs)


libraries = []
macros = []
ext_modules = []
Expand All @@ -69,9 +28,7 @@ def __init__(self, *args, **kwargs):
)
del libraries, macros


setup(
cmdclass={"build_ext": BuildExt, "sdist": Sdist},
ext_modules=ext_modules,
packages=["msgpack"],
)