# HG changeset patch # User Gregory Szorc # Date 2016-11-11 06:26:35 # Node ID 788ea4ac438843f3e437769499c17af1383bc942 # Parent b86a448a2965d0adab582c5dbf65a6b334e4eb20 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. diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -589,6 +589,10 @@ extmodules = [ ['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