Mercurial > hg
changeset 50531:9d1c56a79bb8
zstd: hack include order to ensure that our zstd.h is found
If the regular Python CFLAGS include directories that already have the
zstd headers available, a different and possible incompatible version
can be picked up otherwise. Sadly, it seems like Python has no easy way
to prefix flags before the rest.
author | Joerg Sonnenberger <joerg@bec.de> |
---|---|
date | Mon, 21 Feb 2022 14:44:22 +0100 |
parents | b361e9da3c3b |
children | 116da6bb7e3b |
files | contrib/python-zstandard/setup_zstd.py |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/python-zstandard/setup_zstd.py Thu May 18 17:07:43 2023 -0700 +++ b/contrib/python-zstandard/setup_zstd.py Mon Feb 21 14:44:22 2022 +0100 @@ -145,8 +145,16 @@ include_dirs = set([os.path.join(actual_root, d) for d in ext_includes]) if not system_zstd: - include_dirs.update( - [os.path.join(actual_root, d) for d in zstd_includes] + from distutils import sysconfig + from shlex import quote + + includes = [] + for incdir in [os.path.join(actual_root, d) for d in zstd_includes]: + includes.append('-I' + quote(incdir)) + include_dirs.add(incdir) + config_vars = sysconfig.get_config_vars() + config_vars['CFLAGS'] = ' '.join( + includes + [config_vars.get('CFLAGS', '')] ) if support_legacy: include_dirs.update(