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
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to