|
| 1 | +--- a/pyproject.toml |
| 2 | ++++ b/pyproject.toml |
| 3 | +@@ -2,13 +2,10 @@ |
| 4 | + requires = [ |
| 5 | + "setuptools>=43", |
| 6 | + "wheel", |
| 7 | ++ "Cython==3.0.10", |
| 8 | + ] |
| 9 | + build-backend = "setuptools.build_meta" |
| 10 | + |
| 11 | + [tool.cibuildwheel] |
| 12 | +-before-build = [ |
| 13 | +- "pip install cython==3.0.10", |
| 14 | +- "cython {project}/jq.pyx", |
| 15 | +-] |
| 16 | + test-requires = "-r test-requirements.txt" |
| 17 | + test-command = "pytest {project}/tests" |
| 18 | +diff --git a/setup.py b/setup.py |
| 19 | +index 0b97097..54ed7b3 100644 |
| 20 | +--- a/setup.py |
| 21 | ++++ b/setup.py |
| 22 | +@@ -94,15 +94,27 @@ else: |
| 23 | + os.path.join(jq_lib_dir, "modules/oniguruma/src/.libs/libonig.a"), |
| 24 | + ] |
| 25 | + |
| 26 | ++ |
| 27 | ++try: |
| 28 | ++ # Follow recommendation from https://cython.readthedocs.io/en/latest/src/userguide/source_files_and_compilation.html#distributing-cython-modules |
| 29 | ++ from Cython.Build import cythonize |
| 30 | ++except ImportError: |
| 31 | ++ cythonize = lambda o: o |
| 32 | ++ ext = ".c" |
| 33 | ++else: |
| 34 | ++ ext = ".pyx" |
| 35 | ++ |
| 36 | ++ |
| 37 | + jq_extension = Extension( |
| 38 | + "jq", |
| 39 | +- sources=["jq.c"], |
| 40 | ++ sources=[_path_in_dir(f"jq{ext}")], |
| 41 | + define_macros=[("MS_WIN64" , 1)] if os.name == "nt" and sys.maxsize > 2**32 else None, # https://github.com/cython/cython/issues/2670 |
| 42 | + include_dirs=[os.path.join(jq_lib_dir, "src")], |
| 43 | + extra_link_args=["-lm"] + (["-Wl,-Bstatic", "-lpthread", "-lshlwapi", "-static-libgcc"] if os.name == 'nt' else []) + link_args_deps, |
| 44 | + extra_objects=extra_objects, |
| 45 | + ) |
| 46 | + |
| 47 | ++ |
| 48 | + setup( |
| 49 | + name='jq', |
| 50 | + version='1.8.0', |
| 51 | +@@ -112,7 +124,7 @@ setup( |
| 52 | + url='https://github.com/mwilliamson/jq.py', |
| 53 | + python_requires='>=3.6', |
| 54 | + license='BSD 2-Clause', |
| 55 | +- ext_modules = [jq_extension], |
| 56 | ++ ext_modules = cythonize([jq_extension]), |
| 57 | + cmdclass={"build_ext": jq_build_ext}, |
| 58 | + classifiers=[ |
| 59 | + 'Development Status :: 5 - Production/Stable', |
0 commit comments