Compare commits
No commits in common. "10a7aa7c07b3130bf898acbc25af32a0d5a1495a" and "41a1b6533a362040300bc9455a908be2e6275c2b" have entirely different histories.
10a7aa7c07
...
41a1b6533a
|
@ -1 +1 @@
|
||||||
__version__ = '0.1.4'
|
__version__ = '0.1.3'
|
23
setup.py
23
setup.py
|
@ -15,32 +15,29 @@ PACKAGE_NAME = 'requests_util'
|
||||||
with open('README.md') as f:
|
with open('README.md') as f:
|
||||||
readme = f.read()
|
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:
|
with open(PACKAGE_NAME + '/_version.py') as f:
|
||||||
version = parse_version_file(f.read())
|
text = f.read()
|
||||||
|
match = re.match(r'^__version__\s*=\s*(["\'])([\d\.]+)\1$', text)
|
||||||
|
version = match.group(2)
|
||||||
|
del match, text
|
||||||
|
|
||||||
|
|
||||||
def parse_requirements(text: str) -> list[str]:
|
def parse_requirements(text: str) -> list[str]:
|
||||||
return text.strip().split('\n')
|
return text.strip().split('\n')
|
||||||
|
|
||||||
|
|
||||||
def read_requirements(path: str) -> list[str]:
|
def read_requirements(path: str):
|
||||||
with open(path) as f:
|
with open(path) as f:
|
||||||
return parse_requirements(f.read())
|
return parse_requirements(f.read())
|
||||||
|
|
||||||
|
|
||||||
def determine_short_description(readme: str) -> str:
|
def get_short_description(readme: str):
|
||||||
readme = re.sub(r'#+[^\n]*\n+', '', readme)
|
readme = re.sub(r'#+[^\n]*\n+', '', readme)
|
||||||
m = re.search(r'^\s*(\w+[\w\s,`+-]+\.)', readme)
|
m = re.search(r'^\s*(\w+[\w\s,`-]+\.)', readme)
|
||||||
try:
|
try:
|
||||||
return m.group(1)
|
return m.group(1)
|
||||||
except AttributeError as err:
|
except AttributeError as err:
|
||||||
msg = f'Could not determine short description: {readme}'
|
msg = 'Could not determine short description'
|
||||||
raise Exception(msg) from err
|
raise Exception(msg) from err
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,7 +55,7 @@ pytest
|
||||||
setup(
|
setup(
|
||||||
name=PACKAGE_NAME,
|
name=PACKAGE_NAME,
|
||||||
version=version,
|
version=version,
|
||||||
description=determine_short_description(readme),
|
description=get_short_description(readme),
|
||||||
long_description=readme,
|
long_description=readme,
|
||||||
long_description_content_type='text/markdown',
|
long_description_content_type='text/markdown',
|
||||||
author='Jmaa',
|
author='Jmaa',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user