-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup.py
113 lines (94 loc) · 3.03 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
111
112
113
import glob
import itertools
import os
import sys
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext as _build_ext
from setuptools.command.install import install as _install
DIR = os.path.dirname(__file__)
with open("README.md", "r") as fh:
long_description = fh.read()
class build_ext(_build_ext):
def initialize_options(self):
super(build_ext, self).initialize_options()
self.debug = '--debug' in sys.argv
def finalize_options(self):
from Cython.Build.Dependencies import cythonize
for item in itertools.chain(
glob.glob(os.path.join(DIR, 'src', 'aiozyre', '*.c')),
glob.glob(os.path.join(DIR, 'src', 'aiozyre', '*.h'))):
os.remove(item)
self.distribution.ext_modules[:] = cythonize(
self.distribution.ext_modules,
gdb_debug=self.debug,
)
super(build_ext, self).finalize_options()
# Never install as an egg
self.single_version_externally_managed = False
class install(_install):
user_options = _install.user_options + [
('debug', None, 'Build with debug symbols'),
]
def initialize_options(self):
super(install, self).initialize_options()
self.debug = '--debug' in sys.argv
def finalize_options(self):
super(install, self).finalize_options()
# Never install as an egg
self.single_version_externally_managed = False
def get_pyx():
for path in glob.glob(os.path.join(DIR, 'src', 'aiozyre', '*.pyx')):
module = 'aiozyre.%s' % os.path.splitext(os.path.basename(path))[0]
source = os.path.join('src', 'aiozyre', os.path.basename(path))
yield module, source
setup(
name='aiozyre',
version='1.1.5',
description='asyncio-friendly Python bindings for Zyre',
long_description=long_description,
long_description_content_type="text/markdown",
author='Elijah Shaw-Rutschman',
author_email='[email protected]',
packages=['aiozyre'],
package_dir={
'aiozyre': os.path.join('src', 'aiozyre'),
},
data_files=['README.md', 'LICENSE'],
package_data={
'aiozyre': [
# Include cython source
'*.pyx',
'*.pxd',
],
},
cmdclass={
'build_ext': build_ext,
'install': install
},
ext_modules=[
Extension(
module,
sources=[source],
libraries=['czmq', 'zyre'],
)
for module, source in get_pyx()
],
setup_requires=['cython'],
extras_require={
'dev': [
'blessed',
'aioconsole',
]
},
classifiers=[
'Environment :: Console',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: MacOS :: MacOS X',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3',
'Topic :: System :: Networking',
'Framework :: AsyncIO',
],
zip_safe=False,
)