# HG changeset patch # User Joerg Sonnenberger # Date 1645451062 -3600 # Node ID 9d1c56a79bb81e882d2a0dfde6b35edbcb4779bd # Parent b361e9da3c3bf43821415e5111583eb1811445aa 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. diff -r b361e9da3c3b -r 9d1c56a79bb8 contrib/python-zstandard/setup_zstd.py --- 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(