2017-07-14 03:42:47 +08:00
|
|
|
import os
|
|
|
|
import sys
|
2017-07-03 21:19:06 +08:00
|
|
|
from distutils.core import setup, Extension
|
|
|
|
from distutils import sysconfig
|
2017-06-28 22:08:39 +08:00
|
|
|
|
2017-07-03 21:08:55 +08:00
|
|
|
description = """
|
|
|
|
xlntpyarrow allows Apache Arrow tables to be written to and read from an XLSX
|
|
|
|
file efficiently using the C++ library xlnt.
|
|
|
|
""".strip()
|
|
|
|
|
|
|
|
cfg_vars = sysconfig.get_config_vars()
|
|
|
|
if 'CFLAGS' in cfg_vars:
|
|
|
|
cfg_vars['CFLAGS'] = cfg_vars['CFLAGS'].replace('-Wstrict-prototypes', '')
|
|
|
|
|
2017-07-05 07:03:34 +08:00
|
|
|
project_root = '${CMAKE_SOURCE_DIR}'
|
2017-07-09 12:18:46 +08:00
|
|
|
conda_root = '${CONDA_ROOT}'
|
2017-07-03 23:54:30 +08:00
|
|
|
|
|
|
|
include_dirs = [
|
2017-07-05 07:03:34 +08:00
|
|
|
os.path.join(project_root, 'include'),
|
2017-07-12 11:55:08 +08:00
|
|
|
os.path.join(project_root, 'xlntpyarrow'),
|
2017-07-09 12:18:46 +08:00
|
|
|
os.path.join(conda_root, 'include')
|
2017-07-03 23:54:30 +08:00
|
|
|
]
|
|
|
|
|
2017-07-07 01:28:31 +08:00
|
|
|
subdirectory = ''
|
2017-07-14 09:26:49 +08:00
|
|
|
library_dir = 'lib'
|
2017-07-07 01:28:31 +08:00
|
|
|
|
|
|
|
if os.name == 'nt':
|
|
|
|
subdirectory = '/Release'
|
2017-07-14 09:26:49 +08:00
|
|
|
library_dir = 'Lib/site-packages'
|
2017-07-07 01:28:31 +08:00
|
|
|
|
2017-07-03 23:54:30 +08:00
|
|
|
library_dirs = [
|
2017-07-07 01:28:31 +08:00
|
|
|
os.path.join(project_root, 'build/source' + subdirectory),
|
2017-07-09 12:18:46 +08:00
|
|
|
os.path.join(conda_root, 'lib')
|
2017-07-03 23:54:30 +08:00
|
|
|
]
|
|
|
|
|
2017-07-08 11:16:37 +08:00
|
|
|
compile_args = '${CMAKE_CXX_FLAGS}'.split()
|
2017-07-07 01:28:31 +08:00
|
|
|
|
2017-07-03 21:08:55 +08:00
|
|
|
xlntpyarrow_extension = Extension(
|
|
|
|
'xlntpyarrow',
|
2017-07-05 07:03:34 +08:00
|
|
|
['${CMAKE_CURRENT_SOURCE_DIR}/xlntpyarrow.cpp'],
|
2017-07-03 21:08:55 +08:00
|
|
|
language = 'c++',
|
2017-07-03 23:54:30 +08:00
|
|
|
include_dirs = include_dirs,
|
2017-07-03 21:08:55 +08:00
|
|
|
libraries = [
|
|
|
|
'arrow',
|
|
|
|
'xlnt'
|
|
|
|
],
|
2017-07-05 07:03:34 +08:00
|
|
|
library_dirs = library_dirs,
|
2017-07-07 01:28:31 +08:00
|
|
|
extra_compile_args = compile_args
|
2017-07-03 21:08:55 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
classifiers = [
|
|
|
|
'Development Status :: 5 - Production/Stable',
|
|
|
|
'Environment :: Plugins',
|
|
|
|
'Intended Audience :: Science/Research',
|
|
|
|
'License :: OSI Approved :: MIT License',
|
|
|
|
'Natural Language :: English',
|
|
|
|
'Operating System :: Microsoft :: Windows',
|
|
|
|
'Operating System :: MacOS :: MacOS X',
|
|
|
|
'Operating System :: POSIX :: Linux',
|
|
|
|
'Programming Language :: C',
|
|
|
|
'Programming Language :: C++',
|
|
|
|
'Programming Language :: Python :: 2.7',
|
|
|
|
'Programming Language :: Python :: 3.6',
|
|
|
|
'Programming Language :: Python :: Implementation :: CPython',
|
|
|
|
'Topic :: Database',
|
|
|
|
'Topic :: Office/Business :: Financial :: Spreadsheet',
|
|
|
|
'Topic :: Scientific/Engineering :: Information Analysis',
|
|
|
|
'Topic :: Software Development :: Libraries :: Python Modules'
|
|
|
|
]
|
|
|
|
|
2017-07-14 03:42:47 +08:00
|
|
|
data_files = []
|
|
|
|
|
|
|
|
for arg in sys.argv:
|
|
|
|
if arg[:2] == '--' and arg.split('=')[0][2:] == 'xlntlib':
|
|
|
|
data_files.append(os.path.relpath(arg.split('=')[1]).replace('\\', '/'))
|
|
|
|
sys.argv.remove(arg)
|
|
|
|
break
|
|
|
|
|
2017-07-03 21:08:55 +08:00
|
|
|
setup(
|
|
|
|
name = 'xlntpyarrow',
|
|
|
|
version = '1.1.0',
|
|
|
|
classifiers = classifiers,
|
|
|
|
description = description,
|
|
|
|
ext_modules = [xlntpyarrow_extension],
|
|
|
|
author = 'Thomas Fussell',
|
|
|
|
author_email = 'thomas.fussell@gmail.com',
|
2017-07-14 03:42:47 +08:00
|
|
|
url = 'https://github.com/tfussell/xlnt',
|
2017-07-14 09:26:49 +08:00
|
|
|
data_files = [(library_dir, data_files)]
|
2017-06-28 22:08:39 +08:00
|
|
|
)
|