3
# Copyright 2016 Feather Developers
5
# Licensed under the Apache License, Version 2.0 (the "License");
6
# you may not use this file except in compliance with the License.
7
# You may obtain a copy of the License at
9
# http://www.apache.org/licenses/LICENSE-2.0
11
# Unless required by applicable law or agreed to in writing, software
12
# distributed under the License is distributed on an "AS IS" BASIS,
13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
# See the License for the specific language governing permissions and
15
# limitations under the License.
17
# Bits here from Apache Kudu (incubating), ASL 2.0
19
from Cython.Distutils import build_ext
20
from Cython.Build import cythonize
26
from setuptools import setup
27
from distutils.command.clean import clean as _clean
28
from distutils.extension import Extension
32
if Cython.__version__ < '0.19.1':
33
raise Exception('Please upgrade to Cython 0.19.1 or newer')
38
VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
41
setup_dir = os.path.abspath(os.path.dirname(__file__))
44
def write_version_py(filename=os.path.join(setup_dir, 'feather/version.py')):
49
a = open(filename, 'w')
50
file_content = "\n".join(["",
51
"# THIS FILE IS GENERATED FROM SETUP.PY",
52
"version = '%(version)s'",
53
"isrelease = '%(isrelease)s'"])
55
a.write(file_content % {'version': VERSION,
56
'isrelease': str(ISRELEASED)})
63
for x in ['feather/ext.cpp']:
69
FEATHER_SOURCES = ['feather/ext.pyx']
71
INCLUDE_PATHS = ['feather', np.get_include()]
75
FEATHER_STATIC_BUILD = True
77
if FEATHER_STATIC_BUILD:
78
INCLUDE_PATHS.append(os.path.join(setup_dir, 'src'))
80
FEATHER_SOURCES.extend([
81
'src/feather/buffer.cc',
83
'src/feather/metadata.cc',
84
'src/feather/reader.cc',
85
'src/feather/status.cc',
86
'src/feather/types.cc',
87
'src/feather/writer.cc'
93
if 'FEATHER_HOME' in os.environ:
94
prefix = os.environ['FEATHER_HOME']
95
sys.stderr.write("Building from configured libfeather prefix {0}\n"
98
if os.path.exists("/usr/local/include/feather"):
100
elif os.path.exists("/usr/include/feather"):
103
sys.stderr.write("Cannot find installed libfeather "
106
sys.stderr.write("Building from system prefix {0}\n".format(prefix))
108
feather_include_dir = os.path.join(prefix, 'include')
109
feather_lib_dir = os.path.join(prefix, 'lib')
111
INCLUDE_PATHS.append(feather_include_dir)
113
LIBRARIES.append('feather')
114
LIBRARY_DIRS = [feather_lib_dir]
116
if platform.system() == 'Darwin':
117
EXTRA_LINK_ARGS.append('-Wl,-rpath,' + feather_lib_dir)
120
RT_LIBRARY_DIRS = LIBRARY_DIRS
122
ext = Extension('feather.ext',
126
include_dirs=INCLUDE_PATHS,
127
library_dirs=LIBRARY_DIRS,
128
runtime_library_dirs=RT_LIBRARY_DIRS,
129
extra_compile_args=['-std=c++11', '-O3'],
130
extra_link_args=EXTRA_LINK_ARGS)
132
extensions = cythonize(extensions)
136
LONG_DESCRIPTION = open(os.path.join(setup_dir, "README.md")).read()
137
DESCRIPTION = "Python interface to the Apache Arrow-based Feather File Format"
140
'Development Status :: 3 - Alpha',
141
'Environment :: Console',
142
'Programming Language :: Python',
143
'Programming Language :: Python :: 2',
144
'Programming Language :: Python :: 3',
145
'Programming Language :: Python :: 2.7',
146
'Programming Language :: Python :: 3.4',
147
'Programming Language :: Python :: 3.5',
148
'Programming Language :: Cython'
151
URL = 'http://github.com/wesm/feather'
154
name="feather-format",
155
packages=['feather', 'feather.tests'],
157
package_data={'feather': ['*.pxd', '*.pyx']},
158
ext_modules=extensions,
161
'build_ext': build_ext
163
install_requires=['cython >= 0.21'],
164
description=DESCRIPTION,
165
long_description=LONG_DESCRIPTION,
166
license='Apache License, Version 2.0',
167
classifiers=CLASSIFIERS,
168
author="Wes McKinney",
169
author_email="wesm@apache.org",
171
test_suite="feather.tests"