Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Commit 574dd24

Browse files
committed
MNT: fix sphinx, version issues
1 parent 42a8234 commit 574dd24

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

source/conf.py

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959

6060
# General information about the project.
6161
project = u'wradlib'
62-
copyright = u'2011-2021, wradlib developers'
62+
copyright = u'2011-2022, wradlib developers'
6363
docs = subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode().strip()
6464
url = 'https://github.com/wradlib'
6565

@@ -331,20 +331,28 @@ class WradlibStyle(Style):
331331
register_plugin('pybtex.style.labels', 'wrl', WradlibLabelStyle)
332332
register_plugin('pybtex.style.formatting', 'wrlstyle', WradlibStyle)
333333

334-
# adapt index.rst
335-
file = open('index.rst', mode='r')
336-
index = file.read()
337-
file.close()
334+
# get version
335+
version_tuple = wradlib.version.version_tuple
336+
337+
# is release
338+
if len(version_tuple) == 3:
339+
gh_tree_name = f"v{wradlib.version.version}"
340+
else:
341+
# extract git revision
342+
gh_tree_name = version_tuple[-1].split(".")[0][1:]
338343

339-
longhash = wradlib.version.git_revision
340344
try:
341-
nb = ('`{0} <{1}/wradlib-notebooks/tree/{2}>`_'.format(nb[0:7], url, nb))
345+
nb = ('`{0} <{1}/wradlib-notebooks/tree/{2}>`__'.format(nb[0:7], url, nb))
342346
except NameError:
343347
nb = 'Missing'
344348

345-
docs = ('`{0} <{1}/wradlib-docs/tree/{2}>`_'.format(docs[0:7], url, docs))
346-
rel = ('`{0} <{1}/wradlib/tree/{2}>`_'.format(release, url, longhash))
349+
docs = ('`{0} <{1}/wradlib-docs/tree/{2}>`__'.format(docs[0:7], url, docs))
347350

348-
file = open('index.rst', mode='w')
349-
file.write(index.format(notebooks=nb, docs=docs, release=rel))
350-
file.close()
351+
rel = ('`{0} <{1}/wradlib/tree/{2}>`__'.format(release, url, gh_tree_name))
352+
353+
rst_epilog = ""
354+
rst_epilog += f"""
355+
.. |release-link| replace:: {rel}
356+
.. |notebooks-link| replace:: {nb}
357+
.. |docs-link| replace:: {docs}
358+
"""

source/index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
wradlib: An Open Source Library for Weather Radar Data Processing
77
=================================================================
88

9-
:Release: {release}
9+
:Release: |release-link|
1010
:Date: |today|
11-
:notebooks: {notebooks}
12-
:docs: {docs}
11+
:notebooks: |notebooks-link|
12+
:docs: |docs-link|
1313

1414
The :math:`\omega radlib` project has been initiated in order facilitate the use of weather radar data as well as to provide a common platform for research on new algorithms. :math:`\omega radlib` is an open source library which is well documented and easy to use. It is written in the free programming language `Python <https://www.python.org>`_. As of version 1.3 :math:`\omega radlib` is Python 3 only.
1515

0 commit comments

Comments
 (0)