forked from WarrenWeckesser/npreadtext
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
58 lines (44 loc) · 1.71 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
from os import path
def get_version():
"""
Find the value assigned to __version__ in npreadtext/__init__.py.
This function assumes that there is a line of the form
__version__ = "version-string"
in npreadtext/__init__.py. It returns the string version-string, or None
if such a line is not found.
"""
with open(path.join('npreadtext', '__init__.py'), 'r') as f:
for line in f:
s = [w.strip() for w in line.split('=', 1)]
if len(s) == 2 and s[0] == '__version__':
return s[1][1:-1]
_descr = ('Read text files into a NumPy array.')
with open('README.rst', 'r') as f:
_long_descr = f.read()
def configuration(parent_package='', top_path=None):
import numpy
from numpy.distutils.misc_util import Configuration
config = Configuration(None, parent_package, top_path)
# config.add_data_dir('tests')
config.add_subpackage('npreadtext')
cfiles = ['_readtextmodule.c',
'growth.c', 'rows.c', 'tokenize.c.src',
'conversions.c', 'str_to_int.c',
'stream_pyobject.c', 'field_types.c']
config.add_extension(
'npreadtext._readtextmodule',
sources=[path.join('src', t) for t in cfiles],
include_dirs=[numpy.get_include(), "src"],)
return config
if __name__ == '__main__':
from numpy.distutils.core import setup
setup(
name='npreadtext',
configuration=configuration,
author='Warren Weckesser',
version=get_version(),
description=_descr,
long_description=_long_descr,
classifiers=["Programming Language :: Python :: 3",
"License :: OSI Approved :: BSD License"],
)