forked from Blosc/python-blosc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
102 lines (85 loc) · 3.06 KB
/
setup.py
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
########################################################################
#
# License: MIT
# Created: September 22, 2010
# Author: Francesc Alted - [email protected]
#
########################################################################
import sys, os
from distutils.core import Extension
from distutils.core import setup
########### Check versions ##########
# Check for Python
if sys.version_info[0] == 2:
if sys.version_info[1] < 6:
exit_with_error("You need Python 2.6 or greater to install blosc!")
elif sys.version_info[0] == 3:
if sys.version_info[1] < 1:
exit_with_error("You need Python 3.1 or greater to install blosc!")
else:
exit_with_error("You need Python 2.6/3.1 or greater to install blosc!")
########### End of checks ##########
# Blosc version
VERSION = open('VERSION').read().strip()
# Create the version.py file
open('blosc/version.py', 'w').write('__version__ = "%s"\n' % VERSION)
# Global variables
CFLAGS = os.environ.get('CFLAGS', '').split()
LFLAGS = os.environ.get('LFLAGS', '').split()
lib_dirs = []
libs = ['blosc']
inc_dirs = []
optional_libs = []
# Handle --lflags=[FLAGS] --cflags=[FLAGS]
args = sys.argv[:]
for arg in args:
if arg.find('--lflags=') == 0:
LFLAGS = arg.split('=')[1].split()
sys.argv.remove(arg)
elif arg.find('--cflags=') == 0:
CFLAGS = arg.split('=')[1].split()
sys.argv.remove(arg)
# Add -msse2 flag for optimizing shuffle in Blosc
if os.name == 'posix':
CFLAGS.append("-msse2")
# Add some macros here for debugging purposes, if needed
def_macros = []
classifiers = """\
Development Status :: 4 - Beta
Intended Audience :: Developers
Intended Audience :: Information Technology
Intended Audience :: Science/Research
License :: OSI Approved :: BSD License
Programming Language :: Python
Topic :: Software Development :: Libraries :: Python Modules
Operating System :: Microsoft :: Windows
Operating System :: Unix
"""
setup(name = "blosc",
version = VERSION,
description = 'Blosc data compressor',
long_description = """\
Blosc is a high performance compressor optimized for binary data.
""",
classifiers = filter(None, classifiers.split("\n")),
author = 'Francesc Alted',
author_email = '[email protected]',
maintainer = 'Francesc Alted',
maintainer_email = '[email protected]',
url = 'http://github.com/FrancescAlted/python-blosc',
license = 'http://www.opensource.org/licenses/mit-license.php',
# It is better to upload manually to PyPI
#download_url = 'http://github.com/downloads/FrancescAlted/python-blosc/python-blosc-%s.tar.gz' % (VERSION,),
platforms = ['any'],
ext_modules = [
Extension( "blosc.blosc_extension",
include_dirs=inc_dirs,
define_macros=def_macros,
sources = [ "blosc/blosc_extension.c",],
library_dirs=lib_dirs,
libraries=libs,
extra_link_args=LFLAGS,
extra_compile_args=CFLAGS ),
],
packages = ['blosc'],
)