forked from steeve/python-lz4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
79 lines (72 loc) · 2.7 KB
/
setup.py
File metadata and controls
79 lines (72 loc) · 2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env python
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,
description="LZ4 Bindings for Python",
long_description=open('README.rst', 'r').read(),
author='Steeve Morin',
author_email='steeve.morin@gmail.com',
url='https://github.com/steeve/python-lz4',
packages=find_packages('src'),
package_dir={'': 'src'},
ext_modules=[lz4mod,],
tests_require=["nose>=1.0"],
test_suite = "nose.collector",
classifiers=[
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: BSD License',
'Intended Audience :: Developers',
'Programming Language :: C',
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.3',
],
)