From ee479d08fab79c1771a50f1612b7764f73ecb5e5 Mon Sep 17 00:00:00 2001 From: Erik Tollerud Date: Fri, 17 Nov 2017 00:02:10 -0500 Subject: [PATCH] use sensible dev versions --- tutorials/conf.py | 23 ++++++++++++++++++----- tutorials/dev.rst | 3 ++- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/tutorials/conf.py b/tutorials/conf.py index 30ccd112e..c6014c257 100644 --- a/tutorials/conf.py +++ b/tutorials/conf.py @@ -4,9 +4,9 @@ # Astropy documentation build configuration file. import datetime +import re import os import sys -from os import path # Building from inside the tutorials/ directory? Need to add correct helpers to the python path a_h_path = None @@ -17,6 +17,8 @@ # Load all of the global Astropy configuration try: + # at some point hopefully this can be replaced with installing a + # standalone sphinx-astropy-theme from astropy_helpers.sphinx.conf import * import astropy_helpers @@ -42,6 +44,7 @@ conf.read([os.path.join(os.path.dirname(__file__), '..', 'metadata.cfg')]) setup_cfg = dict(conf.items('metadata')) + # -- General configuration ---------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. @@ -72,11 +75,21 @@ # |version| and |release|, also used in various other places throughout the # built documents. -# The short X.Y version. -version = setup_cfg['version'].split('-', 1)[0] # The full version, including alpha/beta/rc tags. -# release = package.__version__ -release = version +release = setup_cfg['version'] +# The short X.Y version. +version = re.match(r'([\d\.]*)(\D*\d?)', setup_cfg['version']).group(1) +if version.endswith('.'): # e.g. "3.0.dev", which splits into groups "3.0." and "dev" + version = version[:-1] + + +if release.endswith('dev'): + # once the sphinx-astropy-theme is ready, just copy over the git_helpers.py file + # into this repo - it has been long-term stable so the helpers aren't needed + # just for this. + from astropy_helpers.git_helpers import get_git_devstr + release = release + get_git_devstr(path=os.path.join(os.path.split(__file__)[0],'..')) + # -- Options for HTML output -------------------------------------------------- diff --git a/tutorials/dev.rst b/tutorials/dev.rst index 688c8eef5..0652ab764 100644 --- a/tutorials/dev.rst +++ b/tutorials/dev.rst @@ -102,7 +102,8 @@ and ``pip-requirements.txt`` for pip). To actually update the version, modify the ``metadata.cfg`` at the root of this repository with the new version. This is the version number that will be -shown in the sphinx builds. +shown in the sphinx builds. Note that if it ends in ``.dev``, this will be +followed by a revision number that is determined by the number of git commits. Marking a cell with an intentional error ----------------------------------------