1
0
socials-util/setup.py
2024-06-03 22:37:41 +02:00

76 lines
1.6 KiB
Python

#!/usr/bin/env python
#
# WARNING
#
# THIS IS AN AUTOGENERATED FILE.
#
# MANUAL CHANGES CAN AND WILL BE OVERWRITTEN.
import re
from setuptools import setup
PACKAGE_NAME = 'socials_util'
with open('README.md') as f:
readme = f.read()
def parse_version_file(text: str) -> str:
match = re.match(r'^__version__\s*=\s*(["\'])([\d\.]+)\1$', text)
if match is None:
msg = 'Malformed _version.py file!'
raise Exception(msg)
return match.group(2)
with open(PACKAGE_NAME + '/_version.py') as f:
version = parse_version_file(f.read())
def parse_requirements(text: str) -> list[str]:
return text.strip().split('\n')
def read_requirements(path: str) -> list[str]:
with open(path) as f:
return parse_requirements(f.read())
def determine_short_description(readme: str) -> str:
readme = re.sub(r'#+[^\n]*\n+', '', readme)
m = re.search(r'^\s*(\w+[\w\s,`+-]+\.)', readme)
try:
return m.group(1)
except AttributeError as err:
msg = f'Could not determine short description: {readme}'
raise Exception(msg) from err
REQUIREMENTS_MAIN = """
enforce-typing
aenum
"""
REQUIREMENTS_TEST = """
pytest
"""
setup(
name=PACKAGE_NAME,
version=version,
description=determine_short_description(readme),
long_description=readme,
long_description_content_type='text/markdown',
author='Jmaa',
author_email='jonjmaa@gmail.com',
url='https://gitfub.space/Jmaa/' + PACKAGE_NAME,
packages=[PACKAGE_NAME],
install_requires=parse_requirements(REQUIREMENTS_MAIN),
extras_require={
'test': parse_requirements(REQUIREMENTS_TEST),
},
python_requires='>=3.9',
)