-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathsetup.py
More file actions
151 lines (123 loc) · 3.87 KB
/
setup.py
File metadata and controls
151 lines (123 loc) · 3.87 KB
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
""" Setup script for the dxlclient package """
# pylint: disable=no-member, no-name-in-module, import-error, wrong-import-order
# pylint: disable=missing-docstring, no-self-use
from __future__ import absolute_import
import glob
import os
from setuptools import Command, setup
import setuptools.command.sdist
import distutils.command.sdist
import distutils.log
import subprocess
# Patch setuptools' sdist behaviour with distutils' sdist behaviour
setuptools.command.sdist.sdist.run = distutils.command.sdist.sdist.run
PRODUCT_PROPS = {}
CWD = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(CWD, "dxlclient", "_product_props.py")) as f:
exec(f.read(), PRODUCT_PROPS) # pylint: disable=exec-used
class LintCommand(Command):
"""
Custom setuptools command for running lint
"""
description = 'run lint against project source files'
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
self.announce("Running pylint for library source files and tests",
level=distutils.log.INFO)
subprocess.check_call(["pylint", "dxlclient"] + glob.glob("*.py"))
self.announce("Running pylint for examples", level=distutils.log.INFO)
subprocess.check_call(["pylint"] + glob.glob("examples/*.py") +
glob.glob("examples/**/*.py") +
["--rcfile", ".pylintrc.examples"])
class CiCommand(Command):
"""
Custom setuptools command for running steps that are performed during
Continuous Integration testing.
"""
description = 'run CI steps (lint, test, etc.)'
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
self.run_command("lint")
self.run_command("test")
TEST_REQUIREMENTS = [
'futures; python_version == "3.7"',
"mock",
"nose",
"parameterized",
'astroid<2.3.0; python_version == "3.7"',
'astroid==2.3.3; python_version > "3.7"',
"pylint<=2.3.1",
"requests-mock"
]
DEV_REQUIREMENTS = TEST_REQUIREMENTS + ["sphinx"]
setup(
# Application name:
name="dxlclient",
# Version number:
version=PRODUCT_PROPS["__version__"],
# Application author details:
author="McAfee, Inc.",
# License
license="Apache License 2.0",
keywords=['opendxl', 'dxl', 'mcafee', 'client'],
# Custom Paho MQTT Python client with proxy support added as a git submodule
package_dir={
'pahoproxy': 'paho_mqtt_dxl/src/paho/mqtt',
'oscrypto': 'oscrypto/oscrypto'
},
# Packages
packages=[
"dxlclient",
"dxlclient._cli",
"pahoproxy",
"oscrypto",
"oscrypto._openssl",
"oscrypto._mac",
"oscrypto._win",
"oscrypto._linux_bsd"
],
# Include additional files into the package
include_package_data=True,
install_requires=[
"asn1crypto",
"configobj",
"msgpack>=0.5,<1.0.0",
"requests",
"PySocks"
],
tests_require=TEST_REQUIREMENTS,
extras_require={
"dev": DEV_REQUIREMENTS,
"test": TEST_REQUIREMENTS
},
test_suite="nose.collector",
# Details
url="http://www.mcafee.com/",
description="McAfee Data Exchange Layer Client",
long_description=open('README').read(),
python_requires='>=3.7',
classifiers=[
"Topic :: Software Development :: Libraries :: Python Modules",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
],
cmdclass={
'ci': CiCommand,
'lint': LintCommand
},
entry_points={
'console_scripts': [
'dxlclient = dxlclient._cli:cli_run'
],
}
)