summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorSviatoslav Sydorenko <wk@sydorenko.org.ua>2018-01-13 01:25:17 +0200
committerSviatoslav Sydorenko <wk@sydorenko.org.ua>2018-01-13 02:44:40 +0200
commit415731830c1aec6bd9b7057c140586cd10d8bbd6 (patch)
treea5d0a20bb5a34446653d71b1093e59d7abc85dfd /docs
parentb17297420c77f4411e63d614d44dd21f87dc25fb (diff)
downloadcherrypy-git-415731830c1aec6bd9b7057c140586cd10d8bbd6.tar.gz
Calculate min/max supported Py for ref in docs
Diffstat (limited to 'docs')
-rw-r--r--docs/conf.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/docs/conf.py b/docs/conf.py
index 56965edd..08c01e19 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -29,6 +29,18 @@ def try_import(mod_name):
pass
+def get_supported_pythons(classifiers):
+ """Return min and max supported Python version from meta as tuples."""
+ PY_VER_CLASSIFIER = 'Programming Language :: Python :: '
+ vers = filter(lambda c: c.startswith(PY_VER_CLASSIFIER), classifiers)
+ vers = map(lambda c: c[len(PY_VER_CLASSIFIER):], vers)
+ vers = filter(lambda c: c[0].isdigit() and '.' in c, vers)
+ vers = map(lambda c: tuple(c.split('.')), vers)
+ vers = sorted(vers)
+ del vers[1:-1]
+ return vers
+
+
custom_sphinx_theme = try_import('alabaster')
prj_dist = pkg_resources.get_distribution('cherrypy')
@@ -37,6 +49,10 @@ prj_meta = message_from_string(prj_pkg_info)
prj_author = prj_meta['Author']
prj_license = prj_meta['License']
prj_description = prj_meta['Description']
+prj_py_ver_range = get_supported_pythons(prj_meta.get_all('Classifier'))
+prj_py_min_supported, prj_py_max_supported = map(
+ lambda v: '.'.join(v), prj_py_ver_range
+)
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the