-
Notifications
You must be signed in to change notification settings - Fork 46
/
setup.py
executable file
·150 lines (124 loc) · 4.62 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#! /usr/bin/env python
'''Setup file for Unicon Plugins
See:
https://packaging.python.org/en/latest/distributing.html
'''
import os
import re
from setuptools import setup, find_packages
def read(*paths):
'''read and return txt content of file'''
with open(os.path.join(*paths)) as fp:
return fp.read()
def find_version(*paths):
'''reads a file and returns the defined __version__ value'''
version_match = re.search(r"^__version__ ?= ?['\"]([^'\"]*)['\"]",
read(*paths), re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")
def build_version_range(version):
'''
for any given version, return the major.minor version requirement range
eg: for version '3.4.7', return '>=3.4.0, <3.5.0'
'''
non_local_version = version.split('+')[0]
req_ver = non_local_version.split('.')
if 'rc' in version:
version_range = '>= %s.%s.0rc0, < %s.%s.0' % \
(req_ver[0], req_ver[1], req_ver[0], int(req_ver[1])+1)
else:
version_range = '>= %s.%s.0, < %s.%s.0' % \
(req_ver[0], req_ver[1], req_ver[0], int(req_ver[1])+1)
return version_range
def version_info(*paths):
'''returns the result of find_version() and build_version_range() tuple'''
version = find_version(*paths)
return version, build_version_range(version)
# compute version range
version, version_range = version_info('src', 'unicon', 'plugins', '__init__.py')
install_requires = ['unicon {range}'.format(range = version_range),
'pyyaml',
'PrettyTable']
# launch setup
setup(
name = 'unicon.plugins',
version = version,
# descriptions
description = 'Unicon Connection Library Plugins',
long_description = read('DESCRIPTION.rst'),
# the project's main homepage.
url = 'https://developer.cisco.com/pyats',
# author details
author = 'Cisco Systems Inc.',
author_email = '[email protected]',
# project licensing
license = 'Apache 2.0',
# see https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers = [
'Development Status :: 6 - Mature',
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Developers',
'Intended Audience :: Telecommunications Industry',
'Intended Audience :: Information Technology',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: Apache Software License',
'Operating System :: MacOS',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Software Development :: Testing',
'Topic :: Software Development :: Build Tools',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules',
],
# project keywords
keywords = 'unicon connection pyats cisco',
# project packages
packages = ['unicon.%s' %i for i in find_packages(where = 'src/unicon')],
# project directory
package_dir = {
'': 'src',
},
# additional package data files that goes into the package itself
package_data = {'': ['README.rst',
'tests/mock_data/*/*.yaml',
'tests/mock_data/*/*.txt',
'tests/mock_data/*/*/*.txt',
'tests/unittest/ssh_host_key',
'pid_tokens.csv'
]},
# Standalone scripts
scripts = [
],
# package dependencies
install_requires = install_requires,
# any additional groups of dependencies.
# install using: $ pip install -e .[dev]
#
# NOTE: asyncssh is also a dev dependency needed to run unit test,
# but is left off the list to allow continued python 3.4 support.
extras_require = {
'dev': ['setuptools',
'pip',
'wheel',
'coverage',
'restview',
'Sphinx',
'sphinxcontrib-napoleon',
'sphinxcontrib-mockautodoc',
'sphinx-rtd-theme'],
},
# any data files placed outside this package.
# See: http://docs.python.org/3.4/distutils/setupscript.html
# format:
# [('target', ['list', 'of', 'files'])]
# where target is sys.prefix/<target>
data_files = [],
# non zip-safe (never tested it)
zip_safe = False,
)