Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
include README.rst
include src/*.h
include tests/*.py
exclude tests/*.pyc
65 changes: 49 additions & 16 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,57 @@


from setuptools import setup, find_packages, Extension
import subprocess
import os

VERSION = (0, 7, 0)
VERSION_STR = ".".join([str(x) for x in VERSION])

# Check to see if we have a lz4 library installed on the system and
# use it if so. If not, we'll use the bundled library. If lz4 is
# installed it will have a pkg-config file, so we'll use pkg-config to
# check for existence of the library.
pkg_config_exe = os.environ.get('PKG_CONFIG', None) or 'pkg-config'
cmd = '{0} --exists liblz4'.format(pkg_config_exe).split()
liblz4_found = subprocess.call(cmd) == 0

if liblz4_found:
# Use system lz4, and don't set optimization and warning flags for
# the compiler. Specifically we don't define LZ4_VERSION since the
# system lz4 library could be updated (that's the point of a
# shared library).
lz4mod = Extension('lz4',
[
'src/python-lz4.c'
],
extra_compile_args=[
"-std=c99",
"-DVERSION=\"%s\"" % VERSION_STR,
],
libraries=['lz4'],
)
else:
# Use the bundled lz4 libs, and set the compiler flags as they
# historically have been set. We do set LZ4_VERSION here, since it
# won't change after compilation.
lz4mod = Extension('lz4',
[
'src/lz4.c',
'src/lz4hc.c',
'src/python-lz4.c'
],
extra_compile_args=[
"-std=c99",
"-O3",
"-Wall",
"-W",
"-Wundef",
"-DVERSION=\"%s\"" % VERSION_STR,
"-DLZ4_VERSION=\"r130\"",
]
)


setup(
name='lz4',
version=VERSION_STR,
Expand All @@ -16,22 +63,8 @@
url='https://github.com/steeve/python-lz4',
packages=find_packages('src'),
package_dir={'': 'src'},
ext_modules=[
Extension('lz4', [
'src/lz4.c',
'src/lz4hc.c',
'src/python-lz4.c'
], extra_compile_args=[
"-std=c99",
"-O3",
"-Wall",
"-W",
"-Wundef",
"-DVERSION=\"%s\"" % VERSION_STR,
"-DLZ4_VERSION=\"r119\"",
])
],
setup_requires=["nose>=1.0"],
ext_modules=[lz4mod,],
tests_require=["nose>=1.0"],
test_suite = "nose.collector",
classifiers=[
'Development Status :: 5 - Production/Stable',
Expand Down
Loading