Don't build the stream extension module by default
This commit introduces the PYLZ4_EXPERIMENTAL environment variable
to the setup.py file. If this is set to `1` or `TRUE` when setup.py
is executed then the experimental modules are built. Otherwise they
are not.
This commit makes the stream module an experimental module.
#!/usr/bin/env python
+import os
from setuptools import setup, find_packages, Extension
import sys
from distutils import ccompiler
@@ -33,6 +34,14 @@ else:
return installed
liblz4_found = pkgconfig_installed_check('liblz4', LZ4_REQUIRED_VERSION, default=False)
+# Establish if we want to build experimental functionality or not.
+experimental = os.environ.get("PYLZ4_EXPERIMENTAL", False)
+if experimental is not False:
+ if experimental.upper() in ("1", "TRUE"):
+ experimental = True
+ else:
+ experimental = False
+
# Set up the extension modules. If a system wide lz4 library is found, and is
# recent enough, we'll use that. Otherwise we'll build with the bundled one. If
# we're building against the system lz4 library we don't set the compiler
@@ -126,6 +135,11 @@ lz4stream = Extension('lz4.stream._stream',
lz4stream_sources,
**extension_kwargs)
+ext_modules = [lz4version, lz4block, lz4frame]
+
+if experimental is True:
+ ext_modules.append(lz4stream)
+
install_requires = []
# On Python earlier than 3.0 the builtins package isn't included, but it is
@@ -168,12 +182,7 @@ setup(
author_email='jonathan.underwood@gmail.com',
url='https://github.com/python-lz4/python-lz4',
packages=find_packages(),
- ext_modules=[
- lz4version,
- lz4block,
- lz4frame,
- lz4stream
- ],
+ ext_modules=ext_modules,
tests_require=tests_require,
extras_require={
'tests': tests_require,
