summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpencer McIntyre <zeroSteiner@gmail.com>2020-09-11 20:33:25 -0400
committerSpencer McIntyre <zeroSteiner@gmail.com>2021-05-16 12:12:27 -0400
commitf5066257b30f8445a4e65519fb999dc99c3b57d4 (patch)
treebf156815c4872610d024210ccf391df0369a8ffb
parent2751ca930340ec58e9e630fbf89b03f801447be3 (diff)
downloadpluginbase-f5066257b30f8445a4e65519fb999dc99c3b57d4.tar.gz
Update the setup.py to be dynamic
-rw-r--r--setup.py34
1 files changed, 26 insertions, 8 deletions
diff --git a/setup.py b/setup.py
index 541eb42..2650773 100644
--- a/setup.py
+++ b/setup.py
@@ -1,33 +1,52 @@
import os
+import re
import sys
base_directory = os.path.dirname(__file__)
-from setuptools import setup
+try:
+ from setuptools import setup, find_packages
+except ImportError:
+ print('This project needs setuptools in order to build. Install it using your package')
+ print('manager (usually python-setuptools) or via pip (pip install setuptools).')
+ sys.exit(1)
+
+try:
+ with open(os.path.join(base_directory, 'README.rst')) as file_h:
+ long_description = file_h.read()
+except OSError:
+ sys.stderr.write('README.rst is unavailable, can not generate the long description\n')
+ long_description = None
+
+with open(os.path.join(base_directory, 'pluginbase.py')) as file_h:
+ match = re.search(r'^__version__\s*=\s*([\'"])(?P<version>\d+(\.\d)*)\1$', file_h.read(), flags=re.MULTILINE)
+if match is None:
+ raise RuntimeError('Unable to find the version information')
+version = match.group('version')
DESCRIPTION = """\
PluginBase is a module for Python that enables the development of flexible \
plugin systems in Python.\
"""
-with open(os.path.join(base_directory, 'README.md'), 'r') as file_h:
- long_description = file_h.read()
-
setup(
name='pluginbase',
author='Armin Ronacher',
author_email='armin.ronacher@active-4.com',
maintainer='Spencer McIntyre',
maintainer_email='zeroSteiner@gmail.com',
- version='1.0.1',
+ version=version,
description=DESCRIPTION,
long_description=long_description,
- long_description_content_type='text/markdown',
url='http://github.com/mitsuhiko/pluginbase',
py_modules=['pluginbase'],
zip_safe=False,
classifiers=[
+ 'Development Status :: 5 - Production/Stable',
+ 'Environment :: Plugins',
+ 'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
+ 'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
@@ -38,7 +57,6 @@ setup(
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: Implementation :: PyPy',
- 'Environment :: Plugins',
- 'Intended Audience :: Developers',
+ 'Topic :: Software Development :: Libraries :: Python Modules'
]
)