2024-03-11 19:39:12 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
import re
|
|
|
|
|
2024-03-11 19:48:20 +00:00
|
|
|
from setuptools import setup
|
|
|
|
|
2024-03-11 19:39:12 +00:00
|
|
|
PACKAGE_NAME = 'requests_util'
|
|
|
|
|
2024-03-11 19:48:20 +00:00
|
|
|
with open('README.md') as f:
|
2024-03-11 19:39:12 +00:00
|
|
|
readme = f.read()
|
|
|
|
|
2024-03-11 19:48:20 +00:00
|
|
|
with open(PACKAGE_NAME + '/_version.py') as f:
|
2024-03-11 19:39:12 +00:00
|
|
|
text = f.read()
|
|
|
|
match = re.match(r'^__version__\s*=\s*(["\'])([\d\.]+)\1$', text)
|
|
|
|
version = match.group(2)
|
|
|
|
del match, text
|
|
|
|
|
2024-03-11 19:41:04 +00:00
|
|
|
|
2024-03-11 19:39:12 +00:00
|
|
|
def get_short_description(readme: str):
|
|
|
|
readme = re.sub(r'#+[^\n]*\n+', '', readme)
|
2024-03-11 19:48:20 +00:00
|
|
|
m = re.search(r'^\s*(\w+[\w\s,`]+\.)', readme)
|
|
|
|
try:
|
|
|
|
return m.group(1)
|
|
|
|
except AttributeError as err:
|
|
|
|
msg = 'Could not determine short description'
|
|
|
|
raise Exception(msg) from err
|
2024-03-11 19:39:12 +00:00
|
|
|
|
2024-03-11 19:41:04 +00:00
|
|
|
|
2024-03-11 19:39:12 +00:00
|
|
|
setup(
|
|
|
|
name=PACKAGE_NAME,
|
|
|
|
version=version,
|
|
|
|
description=get_short_description(readme),
|
|
|
|
long_description=readme,
|
|
|
|
long_description_content_type='text/markdown',
|
|
|
|
author='Jmaa',
|
|
|
|
author_email='jonjmaa@gmail.com',
|
2024-03-11 19:41:04 +00:00
|
|
|
url='https://gitfub.space/Jmaa/' + PACKAGE_NAME,
|
2024-03-11 19:39:12 +00:00
|
|
|
packages=[PACKAGE_NAME],
|
2024-04-01 13:20:36 +00:00
|
|
|
install_requires=['requests'],
|
2024-03-11 19:41:04 +00:00
|
|
|
extras_require={
|
2024-03-11 19:39:12 +00:00
|
|
|
'Request ratelimiting': ['requests_ratelimiter'],
|
|
|
|
'Request caching': ['requests_cache'],
|
2024-04-01 13:20:36 +00:00
|
|
|
'test': ['pytest'],
|
2024-03-11 19:39:12 +00:00
|
|
|
},
|
|
|
|
)
|