-
Notifications
You must be signed in to change notification settings - Fork 10
/
setup.py
130 lines (96 loc) · 3.41 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
# Copyright (c) 2021-2024 Riverbed Technology, Inc.
#
# This software is licensed under the terms and conditions of the MIT License
# accompanying the software ("License"). This software is distributed "AS IS"
# as set forth in the License.
import sys
import itertools
from setuptools import setup, find_packages, Command
from setuptools.command.test import test as TestCommand
packagedata = True
class MakeSteel(Command):
description = "Create a bootstrap steel.py script for distribution"
user_options = []
def initialize_options(self): pass
def finalize_options(self): pass
def run(self):
path = 'steelscript/commands/steel.py'
bootstrap = 'steel_bootstrap.py'
with open(path) as f:
lines = f.readlines()
for i, line in enumerate(lines):
if line.startswith('__VERSION__'):
lines[i] = "__VERSION__ = '%s'" % get_version()
with open(bootstrap, 'w') as f:
f.writelines(lines)
print(('{0} written.'.format(bootstrap)))
class PyTest(TestCommand):
user_options = [("pytest-args=", "a", "Arguments to pass to pytest")]
def initialize_options(self):
TestCommand.initialize_options(self)
self.pytest_args = ""
def run_tests(self):
import shlex
# import here, cause outside the eggs aren't loaded
import pytest
errno = pytest.main(shlex.split(self.pytest_args))
sys.exit(errno)
install_requires = [
'requests>=2.21.0',
'python-dateutil',
'setuptools'
]
if sys.platform == 'win32':
install_requires.append('pyreadline3') # readline substitute for Windows
# Additional dependencies
test = ['pytest', 'testfixtures', 'mock']
doc = ['sphinx', 'sphinx_rtd_theme']
setup_requires = ['pytest-runner']
setup_args = {
'name': 'steelscript',
'version': '24.2.1',
'author': 'Riverbed Technology',
'author_email': '[email protected]',
'url': 'https://community.riverbed.com',
'license': 'MIT',
'description': 'Core Python module for interacting with Riverbed devices',
'long_description': '''SteelScript
===========
SteelScript is a collection of libraries and scripts in Python and JavaScript for
interacting with Riverbed Technology devices.
For a complete guide to installation, see:
http://pythonhosted.org/steelscript/
''',
'platforms': 'Linux, Mac OS, Windows',
'classifiers': [
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Intended Audience :: Information Technology',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3.12',
'Topic :: System :: Networking',
],
'python_requires': '>=3.9',
'packages': find_packages(exclude=('gitpy_versioning', 'tests*')),
'entry_points': {
'console_scripts': [
'steel = steelscript.commands.steel:run'
]
},
'install_requires': install_requires,
'setup_requires': setup_requires,
'extras_require': {
'test': test,
'doc': doc,
'dev': [p for p in itertools.chain(test, doc)],
'all': []
},
'cmdclass': {
'mksteel': MakeSteel,
'pytest': PyTest
}
}
if packagedata:
setup_args['include_package_data'] = True
setup(**setup_args)