[Request] [+ ] D12207: zstd: hack include order to ensure that our zstd.h is found
joerg.sonnenberger (Joerg Sonnenberger)
phabricator at mercurial-scm.org
Mon Feb 21 13:45:53 UTC 2022
joerg.sonnenberger created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
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.
REPOSITORY
rHG Mercurial
BRANCH
stable
REVISION DETAIL
https://phab.mercurial-scm.org/D12207
AFFECTED FILES
contrib/python-zstandard/setup_zstd.py
CHANGE DETAILS
diff --git a/contrib/python-zstandard/setup_zstd.py b/contrib/python-zstandard/setup_zstd.py
--- a/contrib/python-zstandard/setup_zstd.py
+++ b/contrib/python-zstandard/setup_zstd.py
@@ -145,9 +145,17 @@
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
+ try:
+ from shlex import quote
+ except ImportError:
+ from pipes 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(
[os.path.join(actual_root, d) for d in zstd_includes_legacy]
To: joerg.sonnenberger, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20220221/2cd31335/attachment.html>
More information about the Mercurial-patches
mailing list