forked from chrysn/aiocoap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·130 lines (106 loc) · 4.42 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/usr/bin/env python3
# This file is part of the Python aiocoap library project.
#
# Copyright (c) 2012-2014 Maciej Wasilak <http://sixpinetrees.blogspot.com/>,
# 2013-2014 Christian Amsüss <c.amsuess@energyharvesting.at>
#
# aiocoap is free software, this file is published under the MIT license as
# described in the accompanying LICENSE file.
"""aiocoap is a Python library for writing servers and clients for the CoAP
(Constrained Application) Protocol, which is used mainly in the context of IoT
(Internet of Things) devices."""
from setuptools import setup, find_packages
from distutils.core import Command
import os
name = "aiocoap"
version = "0.4b2.post0" # Don't forget meta.version and doc/conf.py
description = "Python CoAP library"
longdescription = __doc__
# When introducing something new, make sure to update doc/installation.rst
extras_require = {
'linkheader': ['LinkHeader'],
'oscore': ['hkdf', 'cbor', 'cryptography (>= 2.0)', 'filelock'],
'tinydtls': ['DTLSSocket >= 0.1.11a1'],
'prettyprint': ['termcolor', 'cbor', 'LinkHeader', 'pygments'],
'docs': ['sphinx', 'sphinx-argparse'], # extended below
'all': [], # populated below, contains everything but documentation dependencies for easier installation
}
tests_require = [] # populated below
test_extras = extras_require.keys()
if 'AIOCOAP_TEST_EXTRAS' in os.environ:
test_extras = os.environ['AIOCOAP_TEST_EXTRAS'].split(':')
for k, v in extras_require.items():
if k.startswith(':') or k == 'all' or k == 'docs':
continue
# Most extras are required for docs to build. TinyDTLS is an exception
# because no module imports it at module level. (This is convenient also
# because TinyDTLS installation fails on readthedocs for unknown reasons.)
if k != 'tinydtls':
extras_require['docs'].extend(v)
extras_require['all'].extend(v)
if k in test_extras:
tests_require.extend(v)
class Cite(Command):
description = """Print how to cite aiocoap in a publication"""
user_options = [("bibtex", None, "Output citation data as bibtex")]
boolean_options = ["bibtex"]
def initialize_options(self):
self.bibtex = False
def finalize_options(self):
pass
def run(self):
if self.bibtex:
print(self.bibtex_text)
else:
print(self.plain_text)
plain_text = """Amsüss, Christian and Wasilak, Maciej. aiocoap: Python CoAP Library. Energy Harvesting Solutions, 2013–. http://github.com/chrysn/aiocoap/"""
bibtex_text = """@Misc{,
author = {Christian Amsüss and Maciej Wasilak},
organization = {Energy Harvesting Solutions},
title = {{aiocoap}: Python CoAP Library},
year = {2013--},
url = {http://github.com/chrysn/aiocoap/},
}"""
setup(
name=name,
version=version,
description=description,
packages=find_packages(),
author="Maciej Wasilak, Christian Amsüss",
author_email="c.amsuess@energyharvesting.at",
url="https://github.com/chrysn/aiocoap",
keywords=['coap', 'asyncio', 'iot'],
classifiers=[
'Development Status :: 4 - Beta',
'Framework :: AsyncIO',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Topic :: Internet',
'Topic :: Security',
'Topic :: Software Development :: Libraries :: Python Modules',
],
python_requires='>=3.5',
extras_require=extras_require,
tests_require=tests_require,
# see doc/README.doc seciton "dependency hack"
install_requires=extras_require['docs'] if 'READTHEDOCS' in os.environ else [],
entry_points={
'console_scripts': [
'aiocoap-client = aiocoap.cli.client:sync_main',
'aiocoap-proxy = aiocoap.cli.proxy:sync_main',
'aiocoap-rd = aiocoap.cli.rd:sync_main [linkheader]',
# link header is no important dependency (only used for RD
# registration), but currently a hard one
'aiocoap-fileserver = aiocoap.cli.fileserver:FileServerProgram.sync_main [linkheader]',
]
},
cmdclass={
'cite': Cite,
},
# not strictly required any more since tests are now runnable as `-m
# unittest`, but results in more concise output
test_suite='tests',
)