changeset 30436:788ea4ac4388

setup: compile zstd C extension Now that zstd and python-zstandard are vendored, we can start compiling them as part of the install. python-zstandard provides a self-contained Python function that returns a distutils.extension.Extension, so it is really easy to add zstd to our setup.py without having to worry about defining source files, include paths, etc. The function even allows specifying the module name the extension should be compiled as. This conveniently allows us to compile the module into the "mercurial" package so "our" version won't collide with a version installed under the canonical "zstd" module name.
author Gregory Szorc <gregory.szorc@gmail.com>
date Thu, 10 Nov 2016 22:26:35 -0800
parents b86a448a2965
children 64d7275445d0
files setup.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/setup.py	Thu Nov 10 22:15:58 2016 -0800
+++ b/setup.py	Thu Nov 10 22:26:35 2016 -0800
@@ -589,6 +589,10 @@
               ['hgext/fsmonitor/pywatchman/bser.c']),
     ]
 
+sys.path.insert(0, 'contrib/python-zstandard')
+import setup_zstd
+extmodules.append(setup_zstd.get_c_extension('mercurial.zstd'))
+
 try:
     from distutils import cygwinccompiler