-
Notifications
You must be signed in to change notification settings - Fork 12
/
setup.py
97 lines (83 loc) · 2.63 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
from __future__ import print_function
import codecs
import os
import sys
try:
from setuptools import Extension, find_packages, setup
except ImportError:
print('setuptools is required for tt installation.\n'
'You can install it using pip.', file=sys.stderr)
sys.exit(1)
# directories/files
here = os.path.abspath(os.path.dirname(__file__))
tt_dir = os.path.join(here, 'tt')
clibs_dir = os.path.join(tt_dir, '_clibs')
cli_dir = os.path.join(tt_dir, 'cli')
version_file = os.path.join(tt_dir, 'version.py')
# setup kwarg values
tt_pypi_name = 'ttable'
tt_description = ('A library and command-line tool for working with Boolean '
'expressions')
tt_license = 'MIT'
tt_author = 'Brian Welch'
tt_author_email = '[email protected]'
tt_url = 'https://tt.brianwel.ch'
tt_install_requires = [] # no dependencies. Wow!
with codecs.open(version_file, encoding='utf-8') as f:
exec(f.read()) # loads __version__ and __version_info__
tt_version = __version__ # noqa
tt_long_description = 'Please see the project site for more details.'
tt_entry_points = {
'console_scripts': ['tt = tt.__main__:main']
}
tt_classifiers = [
'Environment :: Console',
'License :: OSI Approved :: MIT License',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Topic :: Utilities'
]
# C-extension config
picosat_ext_config = dict(
define_macros=[
('NDEBUG', None)
],
include_dirs=[
os.path.join(clibs_dir, 'picosat')
],
sources=[
os.path.join(clibs_dir, 'picosat', 'picosat.c'),
os.path.join(clibs_dir, 'picosatmodule.c')
]
)
if sys.platform == 'win32':
picosat_ext_config['define_macros'] += [
('NGETRUSAGE', None),
('inline', '__inline')
]
picosat = Extension('tt._clibs.picosat', **picosat_ext_config)
if os.environ.get('READTHEDOCS') == 'True':
# don't build C-extensions on ReadTheDocs
tt_extensions = []
else:
tt_extensions = [picosat]
setup(
name=tt_pypi_name,
version=tt_version,
description=tt_description,
long_description=tt_long_description,
author=tt_author,
author_email=tt_author_email,
url=tt_url,
license=tt_license,
install_requires=tt_install_requires,
packages=find_packages(exclude=['tests', '*.tests', '*.tests.*']),
entry_points=tt_entry_points,
classifiers=tt_classifiers,
ext_modules=tt_extensions
)