From 08e52ab9e4a9c4c98aa3d8a0dbe3721edbb2dbb0 Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Tue, 7 May 2024 21:43:25 +0900 Subject: [PATCH 1/2] do not install cython as build dependency --- pyproject.toml | 6 +----- setup.py | 43 ------------------------------------------- 2 files changed, 1 insertion(+), 48 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f36c7f40..d041d4c0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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] diff --git a/setup.py b/setup.py index eaca7460..e2625e7b 100644 --- a/setup.py +++ b/setup.py @@ -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 = [] @@ -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"], ) From 1966e92560ebfb55062a87c1c4791d99097d3e61 Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Tue, 7 May 2024 21:45:55 +0900 Subject: [PATCH 2/2] remove unused imports --- setup.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/setup.py b/setup.py index e2625e7b..4029e9ed 100644 --- a/setup.py +++ b/setup.py @@ -3,8 +3,6 @@ import sys from setuptools import Extension, setup -from setuptools.command.build_ext import build_ext -from setuptools.command.sdist import sdist PYPY = hasattr(sys, "pypy_version_info")