|
4 | 4 | # Astropy documentation build configuration file.
|
5 | 5 |
|
6 | 6 | import datetime
|
| 7 | +import re |
7 | 8 | import os
|
8 | 9 | import sys
|
9 |
| -from os import path |
10 | 10 |
|
11 | 11 | # Building from inside the tutorials/ directory? Need to add correct helpers to the python path
|
12 | 12 | a_h_path = None
|
|
17 | 17 |
|
18 | 18 | # Load all of the global Astropy configuration
|
19 | 19 | try:
|
| 20 | + # at some point hopefully this can be replaced with installing a |
| 21 | + # standalone sphinx-astropy-theme |
20 | 22 | from astropy_helpers.sphinx.conf import *
|
21 | 23 |
|
22 | 24 | import astropy_helpers
|
|
42 | 44 | conf.read([os.path.join(os.path.dirname(__file__), '..', 'metadata.cfg')])
|
43 | 45 | setup_cfg = dict(conf.items('metadata'))
|
44 | 46 |
|
| 47 | + |
45 | 48 | # -- General configuration ----------------------------------------------------
|
46 | 49 |
|
47 | 50 | # If your documentation needs a minimal Sphinx version, state it here.
|
|
72 | 75 | # |version| and |release|, also used in various other places throughout the
|
73 | 76 | # built documents.
|
74 | 77 |
|
75 |
| -# The short X.Y version. |
76 |
| -version = setup_cfg['version'].split('-', 1)[0] |
77 | 78 | # 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 | + |
80 | 93 |
|
81 | 94 |
|
82 | 95 | # -- Options for HTML output --------------------------------------------------
|
|
0 commit comments