-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathsetup.py
102 lines (93 loc) · 3.12 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
import os
import json
from urllib import request
from setuptools import setup, find_packages
def aggregate_release(lns, acc):
cut = lns[0:3]
rest = lns[4:]
if not lns:
return acc
tag = cut[0].strip()
date = cut[1].strip()
subject = cut[2].strip()
rel_acc = acc.get(tag, [])
rel_acc.append(f"* {date} - {subject}")
acc[tag] = rel_acc
return aggregate_release(rest, acc)
with os.popen('git --no-pager log --tags --pretty="%S%n%aD%n%s%n"') as stream:
lines = stream.readlines()
aggregated = aggregate_release(lines, {})
res = []
for rel, changes in aggregated.items():
ch = '\n'.join(changes)
res.append(f"### {rel}\n\n{ch}\n")
hist = "\n".join(res)
history_header = \
'''
## History
'''
history = history_header + hist
with open('README.md') as readme_file:
readme = readme_file.read()
try:
# This is to force definitions to be upgraded every build not related to the definitions change
defs_url_pypi = "https://pypi.org/pypi/alertlogic-sdk-definitions/json"
with request.urlopen(defs_url_pypi) as defs_rq:
defs_info = json.loads(defs_rq.read())
definitions_latest_version = defs_info['info']['version']
definitions_dependency = 'alertlogic-sdk-definitions>=' + definitions_latest_version
except:
definitions_dependency = 'alertlogic-sdk-definitions>=v0.0.74'
requirements = [
'requests>=2.18',
'configparser>=4.0.2',
'pyyaml>=5.4.1',
'jsonschema[format_nongpl]==3.2.0',
'm2r2==0.3.2',
'boto3>=1.16.57',
definitions_dependency
]
test_requirements = [ ]
setup(
name='alertlogic-sdk-python',
use_scm_version=True,
setup_requires=['setuptools_scm'],
url='https://github.com/alertlogic/alertlogic-sdk-python',
license='MIT license',
author='Alert Logic Inc.',
author_email='[email protected]',
python_requires='>=3.6',
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8'
],
description='Alert Logic Software Development Kit for Python.',
long_description=readme + '\n\n' + history,
long_description_content_type='text/markdown',
scripts=[],
packages=find_packages(exclude=['contrib', 'docs', 'tests*', 'troubleshooting']),
include_package_data=True,
test_suite='tests',
tests_require=test_requirements,
zip_safe=False,
platforms='any',
install_requires=requirements,
extras_require={
'dev': [
'pytest>=3',
'mock>=2.0.0',
'httpretty>=0.8.14',
'pycodestyle>=2.3.1',
'jsonschema[format_nongpl]==3.2.0'
],
},
keywords=['alertlogic-sdk', 'alertlogic-sdk-python', 'alertlogic-mdr-sdk', 'almdrlib', 'alertlogic']
)