1
|
|
|
#!/usr/bin/env python |
2
|
|
|
|
3
|
|
|
import sys |
4
|
|
|
|
5
|
|
|
from setuptools import setup |
6
|
|
|
|
7
|
|
|
from subprocess import check_output |
8
|
|
|
import platform |
9
|
|
|
|
10
|
|
|
def get_version(): |
11
|
|
|
"""Get the current version from a git tag, or by reading tdl/version.py""" |
12
|
|
|
try: |
13
|
|
|
version = check_output(['git', 'describe', '--abbrev=0'], |
14
|
|
|
universal_newlines=True) |
15
|
|
|
assert version.startswith('v') |
16
|
|
|
version = version[1:-1] # remove `v` and newline |
17
|
|
|
open('tdl/version.py', 'w').write('__version__ = %r\n' % version) |
18
|
|
|
except: |
19
|
|
|
exec(open('tdl/version.py').read()) |
20
|
|
|
return __version__ |
21
|
|
|
|
22
|
|
|
is_pypy = platform.python_implementation() == 'PyPy' |
23
|
|
|
|
24
|
|
|
def get_package_data(): |
25
|
|
|
'''get data files which will be included in the main tcod/ directory''' |
26
|
|
|
BITSIZE, LINKAGE = platform.architecture() |
27
|
|
|
files = [ |
28
|
|
|
'lib/LIBTCOD-CREDITS.txt', |
29
|
|
|
'lib/LIBTCOD-LICENSE.txt', |
30
|
|
|
'lib/README-SDL.txt' |
31
|
|
|
] |
32
|
|
|
if 'win32' in sys.platform: |
33
|
|
|
if BITSIZE == '32bit': |
34
|
|
|
files += ['x86/SDL2.dll'] |
35
|
|
|
else: |
36
|
|
|
files += ['x64/SDL2.dll'] |
37
|
|
|
if sys.platform == 'darwin': |
38
|
|
|
files += ['SDL2.framework/Versions/A/SDL2'] |
39
|
|
|
return files |
40
|
|
|
|
41
|
|
|
needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv) |
42
|
|
|
pytest_runner = ['pytest-runner'] if needs_pytest else [] |
43
|
|
|
|
44
|
|
|
setup( |
45
|
|
|
name='tdl', |
46
|
|
|
version=get_version(), |
47
|
|
|
author='Kyle Stewart', |
48
|
|
|
author_email='[email protected]', |
49
|
|
|
description='Pythonic cffi port of libtcod.', |
50
|
|
|
long_description='\n'.join([open('README.rst', 'r').read(), |
51
|
|
|
open('CHANGELOG.rst', 'r').read()]), |
52
|
|
|
url='https://github.com/HexDecimal/python-tdl', |
53
|
|
|
download_url='https://pypi.python.org/pypi/tdl', |
54
|
|
|
packages=['tdl', 'tcod'], |
55
|
|
|
package_data={ |
56
|
|
|
'tdl': ['*.png'], |
57
|
|
|
'tcod': get_package_data(), |
58
|
|
|
}, |
59
|
|
|
install_requires=[ |
60
|
|
|
'cffi>=1.8.1,<2', |
61
|
|
|
'numpy>=1.10,<2' if not is_pypy else '', |
62
|
|
|
], |
63
|
|
|
cffi_modules=['build_libtcod.py:ffi'], |
64
|
|
|
setup_requires=[ |
65
|
|
|
'cffi>=1.8.1,<2', |
66
|
|
|
'pycparser>=2.14,<3', |
67
|
|
|
] + pytest_runner, |
68
|
|
|
tests_require=[ |
69
|
|
|
'pytest', |
70
|
|
|
'pytest-cov', |
71
|
|
|
'pytest-benchmark', |
72
|
|
|
], |
73
|
|
|
classifiers=[ |
74
|
|
|
'Development Status :: 5 - Production/Stable', |
75
|
|
|
'Environment :: Win32 (MS Windows)', |
76
|
|
|
'Environment :: MacOS X', |
77
|
|
|
'Environment :: X11 Applications', |
78
|
|
|
'Intended Audience :: Developers', |
79
|
|
|
'License :: OSI Approved :: BSD License', |
80
|
|
|
'Natural Language :: English', |
81
|
|
|
'Operating System :: POSIX', |
82
|
|
|
'Operating System :: MacOS :: MacOS X', |
83
|
|
|
'Operating System :: Microsoft :: Windows', |
84
|
|
|
'Programming Language :: Python :: 2', |
85
|
|
|
'Programming Language :: Python :: 2.7', |
86
|
|
|
'Programming Language :: Python :: 3', |
87
|
|
|
'Programming Language :: Python :: 3.4', |
88
|
|
|
'Programming Language :: Python :: 3.5', |
89
|
|
|
'Programming Language :: Python :: 3.6', |
90
|
|
|
'Programming Language :: Python :: Implementation :: CPython', |
91
|
|
|
'Programming Language :: Python :: Implementation :: PyPy', |
92
|
|
|
'Topic :: Games/Entertainment', |
93
|
|
|
'Topic :: Multimedia :: Graphics', |
94
|
|
|
'Topic :: Software Development :: Libraries :: Python Modules', |
95
|
|
|
], |
96
|
|
|
keywords='roguelike cffi Unicode libtcod fov heightmap namegen', |
97
|
|
|
platforms=[ |
98
|
|
|
'Windows', |
99
|
|
|
'MacOS', |
100
|
|
|
'Linux', |
101
|
|
|
], |
102
|
|
|
license='Simplified BSD License', |
103
|
|
|
) |
104
|
|
|
|