-
Notifications
You must be signed in to change notification settings - Fork 23
/
setup.py
110 lines (97 loc) · 3.44 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
103
104
105
106
107
108
109
110
"""
@author: Otto Fajardo
"""
import setuptools
import sys
import platform
import glob
from setuptools import setup, Extension
from Cython.Build import cythonize
import Cython
cyver = int(Cython.__version__.split(".")[0])
if cyver < 3:
raise Exception("cython 3.0.0 or newer is required")
librdata_source_files = []
librdata_source_files += glob.glob('pyreadr/libs/librdata/src/*.c')
librdata_source_files += ['pyreadr/librdata.pyx']
library_dirs = []
libraries = []
include_dirs = []
extra_link_args = []
extra_compile_args = ['-DHAVE_ZLIB', '-DHAVE_BZIP2', '-DHAVE_LZMA']
package_data ={'pryeadr': ["*.c", "*.pyx", "*.pxd"]}
exclude_package_data = {'pyreadr': ["*.dll", "*.lib"]}
include_package_data=True
if platform.system() == 'Darwin':
libraries.append("iconv")
elif platform.system() == 'Windows':
is64bit = sys.maxsize > 2 ** 32
if not is64bit:
msg = "Python 32 bit is not supported on Windows. Please use Python 64 bit"
raise Exception(msg)
include_dirs.append(".")
include_dirs.append('pyreadr')
include_dirs.append('pyreadr/libs/zlib')
include_dirs.append('pyreadr/libs/bzip2')
include_dirs.append('pyreadr/libs/lzma')
include_dirs.append('pyreadr/libs/librdata')
include_dirs.append('pyreadr/libs/iconv')
library_dirs.append('pyreadr/libs/librdata')
package_data ={'pryeadr': ["*.c", "*.pyx", "*.pxd", "*.dll", "*.lib"]}
exclude_package_data = {}
include_package_data=True
library_dirs.append("pyreadr")
libraries.append('z')
libraries.append('iconv')
libraries.append('bz2')
libraries.append('lzma')
elif platform.system() == 'Linux':
libraries.append('z')
libraries.append('bz2')
libraries.append('lzma')
#extra_compile_args.append("--std=gnu99")
else:
raise RuntimeError('Unsupported OS')
librdata = Extension(
'pyreadr.librdata',
sources=librdata_source_files,
library_dirs=library_dirs,
libraries=libraries,
include_dirs=include_dirs,
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args)
long_description = """ A Python package to read and write R RData and Rds files
into/from pandas data frames. It does not need to have R or other external
dependencies installed.
It is based on the C library librdata and
a modified version of the cython wrapper jamovi-readstat.<br>
Please visit out project home page for more information:<br>
https://github.com/ofajardo/pyreadr
"""
short_description = "Reads/writes R RData and Rds files into/from pandas data frames."
setup(
name='pyreadr',
version='0.5.2',
ext_modules=cythonize([librdata], force=True),
packages=["pyreadr"],
include_package_data=include_package_data,
exclude_package_data=exclude_package_data,
install_requires=['pandas>=1.2.0'],
license="AGPLv3",
classifiers=[
"Programming Language :: Python",
"Programming Language :: Cython",
"Programming Language :: C",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering",
"Environment :: Console",
"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
],
description=short_description,
author="Otto Fajardo",
author_email="pleasecontactviagithub@notvalid.com",
url="https://github.com/ofajardo/pyreadr",
download_url="https://pypi.org/project/pyreadr/#files",
long_description=long_description,
long_description_content_type="text/markdown"
)