-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup.py
61 lines (51 loc) · 1.99 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
from setuptools import setup, Extension, find_packages
import imp
import os.path
import platform
LIBANCILLARY = ['ext/libancillary/' + p for p in ['fd_send.c', 'fd_recv.c']]
ANCILLARY = Extension('_ancillary', ['ext/ancillary.c'] + LIBANCILLARY)
PLATFORM_EXTENSIONS = {
'Darwin': [Extension('_filedes', ['ext/posix_filedes.c',
'ext/darwin_filedes.c'])] + [ANCILLARY],
'Linux': [Extension('_filedes', ['ext/posix_filedes.c',
'ext/linux_filedes.c'])] + [ANCILLARY],
}
ROOT = os.path.abspath(os.path.dirname(__file__))
def read(*fname):
"""Read a file relative to the repository root"""
return open(os.path.join(ROOT, *fname)).read()
def version():
"""Return the version number from filedes/version.py"""
result = {}
exec read("filedes", "__version__.py") in result
return result['__version__']
if __name__ == '__main__':
VERSION = version()
kwargs = dict(
name='filedes',
version=version(),
description="Work with file descriptors in a more human way",
long_description=read("README.rst"),
packages=find_packages(exclude=['tests', 'tests.*']),
author='Peter Ruibal',
author_email='[email protected]',
license='ISC',
keywords='file-descriptor fd filedes',
url='http://github.com/fmoo/python-filedes',
download_url='https://github.com/fmoo/python-filedes'
'/archive/%s.tar.gz' % VERSION,
classifiers=[
"Development Status :: 4 - Beta",
"License :: OSI Approved :: ISC License (ISCL)",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: Linux",
],
install_requires=["unittest2"],
setup_requires=['unittest2'],
test_suite="tests",
)
# Add extension modules (as necessary)
kwargs.update(dict(
ext_modules=PLATFORM_EXTENSIONS.get(platform.system(), [])
))
setup(**kwargs)