-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
93 lines (82 loc) · 3.21 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
import os
import re
from pathlib import Path
from setuptools import setup
# The directory containing this file
HERE = Path(__file__).parent
version = ''
with open(f'{HERE}/instatus/__init__.py') as f:
version += re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE).group(1)
v = None
if os.path.isfile('version.txt'):
with open('version.txt', 'r') as fp:
v = fp.read()
if version and not v:
i = input(f'are you sure to use version {version}>> ')
version = i if i else version
with open('version.txt', 'w') as fp:
fp.write(i)
if not (version or v):
version = input('please set an version>> ')
if not version:
raise RuntimeError('version is not set')
if version.endswith(('a', 'b', 'rc')):
# append version identifier based on commit count
try:
import subprocess
p = subprocess.Popen(['git', 'rev-list', '--count', 'HEAD'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
if out:
version += out.decode('utf-8').strip()
p = subprocess.Popen(['git', 'rev-parse', '--short', 'HEAD'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
if out:
version += '+g' + out.decode('utf-8').strip()
except Exception as exc:
pass
# The text of the README file
readme = Path('./README.rst').read_text(encoding='utf-8')
#
extras_require = {
'docs': [
'sphinx==3.0.3',
'sphinxcontrib_trio==1.1.2',
'sphinxcontrib-websupport',
]
}
# This call to setup() does all the work
setup(
name="instatus.py",
url="https://github.com/mccoderpy/instatus.py",
project_urls={'Source': 'https://github.com/mccoderpy/instatus.py', 'Support': 'https://discord.gg/sb69muSqsg', 'Issue Tracker': 'https://github.com/mccoderpy/instatus.py/issues'},
author_email="[email protected]",
version=str(v if v else version),
author="mccoder.py",
description="A simple asyncron wrapper for the Instatus-API",
keywords='instatus instatus.py instatus-api api-wrapper statistics async-api-wrapper python-3 python3 asyncio',
long_description=readme,
long_description_content_type="text/x-rst",
extras_require=extras_require,
license="MIT",
classifiers=[
'Development Status :: 4 - Beta',
'License :: OSI Approved :: MIT License',
'Intended Audience :: Developers',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.9',
'Topic :: Internet',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Utilities'
],
packages=['instatus'],
include_package_data=True,
install_requires=["aiohttp", "chardet", "yarl", "async-timeout", "typing-extensions", "attrs", "multidict", "idna"],
python_requires=">=3.7"
)