--- a/setup.py +++ b/setup.py @@ -34,7 +34,6 @@ LIB_SOURCES = [ "core/string_utils.cpp", "core/vm.cpp", "third_party/md5/md5.cpp", - "third_party/rapidyaml/rapidyaml.cpp", "python/_jsonnet.c", ] @@ -113,6 +112,12 @@ if not hasattr(sys, "_is_gil_enabled") o _PY_LIMITED_API = 0x03080000 _bdist_limited_api_tag = "cp38" +macros = [ + ("USE_SYSTEM_RAPIDYAML","1"), + ("RYML_NEW_ERROR_API","1"), +] +if _PY_LIMITED_API is not None: + macros.append(("Py_LIMITED_API", f"{_PY_LIMITED_API:#010x}")) setuptools.setup( name="jsonnet", @@ -124,19 +129,14 @@ setuptools.setup( ext_modules=[ setuptools.Extension( "_jsonnet", - define_macros=( - [("Py_LIMITED_API", f"{_PY_LIMITED_API:#010x}")] - if _PY_LIMITED_API is not None - else [] - ), + define_macros=macros, py_limited_api=(_PY_LIMITED_API is not None), sources=LIB_SOURCES, include_dirs=[ "include", "third_party/md5", - "third_party/json", - "third_party/rapidyaml", ], + libraries=["ryml"], language="c++", ) ],