Skip to content

Commit ee479d0

Browse files
committed
use sensible dev versions
1 parent 3d32db3 commit ee479d0

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

tutorials/conf.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
# Astropy documentation build configuration file.
55

66
import datetime
7+
import re
78
import os
89
import sys
9-
from os import path
1010

1111
# Building from inside the tutorials/ directory? Need to add correct helpers to the python path
1212
a_h_path = None
@@ -17,6 +17,8 @@
1717

1818
# Load all of the global Astropy configuration
1919
try:
20+
# at some point hopefully this can be replaced with installing a
21+
# standalone sphinx-astropy-theme
2022
from astropy_helpers.sphinx.conf import *
2123

2224
import astropy_helpers
@@ -42,6 +44,7 @@
4244
conf.read([os.path.join(os.path.dirname(__file__), '..', 'metadata.cfg')])
4345
setup_cfg = dict(conf.items('metadata'))
4446

47+
4548
# -- General configuration ----------------------------------------------------
4649

4750
# If your documentation needs a minimal Sphinx version, state it here.
@@ -72,11 +75,21 @@
7275
# |version| and |release|, also used in various other places throughout the
7376
# built documents.
7477

75-
# The short X.Y version.
76-
version = setup_cfg['version'].split('-', 1)[0]
7778
# The full version, including alpha/beta/rc tags.
78-
# release = package.__version__
79-
release = version
79+
release = setup_cfg['version']
80+
# The short X.Y version.
81+
version = re.match(r'([\d\.]*)(\D*\d?)', setup_cfg['version']).group(1)
82+
if version.endswith('.'): # e.g. "3.0.dev", which splits into groups "3.0." and "dev"
83+
version = version[:-1]
84+
85+
86+
if release.endswith('dev'):
87+
# once the sphinx-astropy-theme is ready, just copy over the git_helpers.py file
88+
# into this repo - it has been long-term stable so the helpers aren't needed
89+
# just for this.
90+
from astropy_helpers.git_helpers import get_git_devstr
91+
release = release + get_git_devstr(path=os.path.join(os.path.split(__file__)[0],'..'))
92+
8093

8194

8295
# -- Options for HTML output --------------------------------------------------

tutorials/dev.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ and ``pip-requirements.txt`` for pip).
102102

103103
To actually update the version, modify the ``metadata.cfg`` at the root of this
104104
repository with the new version. This is the version number that will be
105-
shown in the sphinx builds.
105+
shown in the sphinx builds. Note that if it ends in ``.dev``, this will be
106+
followed by a revision number that is determined by the number of git commits.
106107

107108
Marking a cell with an intentional error
108109
----------------------------------------

0 commit comments

Comments
 (0)