diff --git a/setup.py b/setup.py index a950dd9..bf5ae6d 100644 --- a/setup.py +++ b/setup.py @@ -1,13 +1,14 @@ #!/usr/bin/env python -from setuptools import setup import re +from setuptools import setup + PACKAGE_NAME = 'requests_util' -with open('README.md', 'r') as f: +with open('README.md') as f: readme = f.read() -with open(PACKAGE_NAME + '/_version.py', 'r') as f: +with open(PACKAGE_NAME + '/_version.py') as f: text = f.read() match = re.match(r'^__version__\s*=\s*(["\'])([\d\.]+)\1$', text) version = match.group(2) @@ -16,9 +17,12 @@ with open(PACKAGE_NAME + '/_version.py', 'r') as f: def get_short_description(readme: str): readme = re.sub(r'#+[^\n]*\n+', '', readme) - m = re.search(r'^\s*(\w+[\w\s,]+\.)', readme) - readme = m.group(1) - return readme + 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 setup(