Skip to content

Commit ec84814

Browse files
committed
Add an environment variable to control building yajl2_c
Add a IJSON_BUILD_YAJL2C environment variable to make it possible to override whether yajl2_c is being built. The default is to build it if either yajl2 is found or embedding is enabled. However, the envvar can be used to either force building (i.e. effectively make the build fail if yajl2 is not detected) or disable building it even if yajl2 is installed. The primary use case is to make it possible to disable building the extension for PyPy3 where it is currently known to be broken. Signed-off-by: Michał Górny <[email protected]>
1 parent 6160330 commit ec84814

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ def patch_yajl_sources():
117117
extra_sources.remove(os.path.join(yajl_sources, 'src', 'yajl_version.c'))
118118
extra_include_dirs = [yajl_sources, os.path.join(yajl_sources, 'src')]
119119
libs = []
120-
if embed_yajl or have_yajl:
120+
build_yajl_default = '1' if embed_yajl or have_yajl else '0'
121+
build_yajl = os.environ.get('IJSON_BUILD_YAJL2C', build_yajl_default) == '1'
122+
if build_yajl:
121123
yajl_ext = Extension('ijson.backends._yajl2',
122124
language='c',
123125
sources=sorted(glob.glob('ijson/backends/yajl2_c/*.c')) + extra_sources,

0 commit comments

Comments
 (0)