Skip to content

Commit 92d279e

Browse files
timfelmsimacek
authored andcommitted
[GR-62557] Add patch for jq to recythonize the C code.
1 parent 3fce96f commit 92d279e

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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',

graalpython/lib-graalpython/patches/metadata.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,15 @@ version = '<=1.3.2'
200200
patch = 'joblib-1.3.2.patch'
201201
license = 'BSD-3-Clause'
202202

203+
[[jq.rules]]
204+
version = '==1.8.0'
205+
patch = 'jq-1.8.0.patch'
206+
license = 'BSD-2-Clause'
207+
208+
[[jq.add-sources]]
209+
version = '1.8.0'
210+
url = 'https://github.com/mwilliamson/jq.py/archive/refs/tags/1.8.0.tar.gz'
211+
203212
[[jupyter_server.rules]]
204213
patch = 'jupyter_server.patch'
205214
license = 'BSD-3-Clause'

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy