Skip to content

Commit c73f478

Browse files
Merge pull request #907 from samdoran/backport/894/release_2.1
[release_2.1] Set version in docs configuration (#894) Backport of #894 for Ansible Runner 2.1. Reviewed-by: David Shrewsbury <None> Reviewed-by: None <None>
2 parents c0db181 + c02072c commit c73f478

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

.readthedocs.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,8 @@ sphinx:
1616

1717
python:
1818
install:
19+
# Installation is needed in order to get the version string
20+
- method: pip
21+
path: .
22+
1923
- requirements: docs/requirements.txt

docs/conf.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,23 @@
1212
# add these directories to sys.path here. If the directory is relative to the
1313
# documentation root, use os.path.abspath to make it absolute, like shown here.
1414
#
15-
import os
16-
import sys
17-
sys.path.insert(0, os.path.abspath('../'))
18-
sys.path.insert(0, os.path.abspath('.'))
19-
sys.path.insert(0, os.path.abspath('./'))
15+
import datetime
16+
17+
from ansible_runner.__main__ import VERSION
2018

2119

2220
# -- Project information -----------------------------------------------------
2321

22+
def _get_version():
23+
version_parts = VERSION.split('.', 3)[:3]
24+
25+
return '.'.join(version_parts)
26+
27+
2428
project = 'ansible-runner'
25-
copyright = '2018, Red Hat Ansible'
26-
author = 'Red Hat Ansible'
29+
copyright = f'2018-{datetime.datetime.today().year}, Red Hat, Inc'
30+
author = 'Red Hat, Inc.'
31+
version = _get_version()
2732

2833
# -- General configuration ---------------------------------------------------
2934

tox.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,5 @@ commands=
2727
[testenv:docs]
2828
description = Build documentation
2929
deps = -r{toxinidir}/docs/requirements.txt
30-
skip_install = True
3130
commands =
3231
sphinx-build -T -E -W --keep-going {tty:--color} -j auto -d docs/build/doctrees -b html docs docs/build/html

0 commit comments

Comments
 (0)