forked from NordicSemiconductor/pc-ble-driver-py
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
131 lines (114 loc) · 4.97 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
131
#
# Copyright (c) 2016-2019 Nordic Semiconductor ASA
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this
# list of conditions and the following disclaimer in the documentation and/or
# other materials provided with the distribution.
#
# 3. Neither the name of Nordic Semiconductor ASA nor the names of other
# contributors to this software may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# 4. This software must only be used in or with a processor manufactured by Nordic
# Semiconductor ASA, or in or with a processor manufactured by a third party that
# is used in combination with a processor manufactured by Nordic Semiconductor.
#
# 5. Any software provided in binary or object form under this license must not be
# reverse engineered, decompiled, modified and/or disassembled.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
import sys
import re
import codecs
import os
from skbuild import setup
from setuptools import find_packages
py2 = sys.version_info[0] == 2
py3 = sys.version_info[0] == 3
py_version_old_message = 'pc-ble-driver-py only supports Python version 3.6 and newer'
requirements = []
if py2:
print(py_version_old_message)
sys.exit(-1)
elif py3:
if sys.version_info[1] < 6:
print(py_version_old_message)
sys.exit(-1)
requirements = ['wrapt', 'future']
else:
print(py_version_old_message)
sys.exit(-1)
if os.path.exists('MANIFEST'):
os.remove('MANIFEST')
here = os.path.abspath(os.path.dirname(__file__))
def read(*parts):
# intentionally *not* adding an encoding option to open, See:
# https://github.com/pypa/virtualenv/issues/201#issuecomment-3145690
with codecs.open(os.path.join(here, *parts), 'r') as fp:
return fp.read()
def find_version(*file_paths):
version_file = read(*file_paths)
version_match = re.search(
r"^__version__ = ['\"]([^'\"]*)['\"]",
version_file,
re.M,
)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")
packages = find_packages(exclude=["tests*"])
setup(
name='pc_ble_driver_py',
version=find_version("pc_ble_driver_py", "__init__.py"),
description='Python bindings for the Nordic pc-ble-driver SoftDevice serialization library',
long_description='A Python interface and library for pc-ble-driver. This allows Python applications to interface '
'with a Nordic Semiconductor IC (both nRF51 and nRF52 series) over a serial port to obtain '
'access to the full serialized SoftDevice API.',
url='https://github.com/NordicSemiconductor/pc-ble-driver-py',
license='Modified BSD License',
author='Nordic Semiconductor ASA',
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Operating System :: MacOS',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX :: Linux',
'Topic :: System :: Networking',
'Topic :: System :: Hardware :: Hardware Drivers',
'Topic :: Software Development :: Embedded Systems',
'License :: Other/Proprietary License',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8'
],
keywords='nordic nrf51 nrf52 ble bluetooth softdevice serialization bindings pc-ble-driver pc-ble-driver-py '
'pc_ble_driver pc_ble_driver_py',
python_requires=">=3.6, <3.9",
install_requires=requirements,
packages=packages,
package_data={
'pc_ble_driver_py.lib': ['*.pyd', '*.dll', '*.txt','*.so','*.dylib'],
'pc_ble_driver_py.hex': ['*.hex'],
'pc_ble_driver_py.hex.sd_api_v2': ['*.hex'],
'pc_ble_driver_py.hex.sd_api_v5': ['*.hex', '*.zip']
}
)