Skip to content

Commit 9e8f12c

Browse files
authored
Make use of newer sphinxcontrib-programoutput2 extension (#1458)
The newer version of programoutput does render ANSI escapes from our examples, making them easier to read. Also swaps the codeclimate docs example with a smaller one, as we do need to display a big file to demonstrate this functionality.
1 parent a6d5e99 commit 9e8f12c

File tree

6 files changed

+36
-18
lines changed

6 files changed

+36
-18
lines changed

docs/conf.py

+19-5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
import sys
1919
from pathlib import Path
2020

21+
import pkg_resources
22+
2123
# Make in-tree extension importable in non-tox setups/envs, like RTD.
2224
# Refs:
2325
# https://github.com/readthedocs/readthedocs.org/issues/6311
@@ -55,6 +57,18 @@
5557
'rules_table_generator_ext', # in-tree extension
5658
]
5759

60+
61+
# Fail safe protection to detect conflicting packages
62+
try:
63+
pkg_resources.get_distribution("sphinxcontrib-programoutput")
64+
print(
65+
"FATAL: We detected presence of sphinxcontrib-programoutput package instead of sphinxcontrib-programoutput2 one. You must be sure the first is not installed.",
66+
file=sys.stderr,
67+
)
68+
sys.exit(2)
69+
except pkg_resources.DistributionNotFound:
70+
pass
71+
5872
# Later on, add 'sphinx.ext.viewcode' to the list if you want to have
5973
# colorized code generated too for references.
6074

@@ -251,8 +265,8 @@
251265

252266
# table width fix via: https://rackerlabs.github.io/docs-rackspace/tools/rtd-tables.html
253267
html_static_path = ['_static']
254-
html_context = {
255-
'css_files': [
256-
'_static/theme_overrides.css', # override wide tables in RTD theme
257-
],
258-
}
268+
269+
html_css_files = [
270+
'theme_overrides.css', # override wide tables in RTD theme
271+
'ansi.css',
272+
]

docs/requirements.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ myst-parser
33
pipdeptree
44
Sphinx
55
sphinx_ansible_theme
6-
sphinxcontrib.programoutput
6+
sphinxcontrib-programoutput2>=2.0a1

docs/requirements.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,27 @@ myst-parser==0.13.5
2727
packaging==20.9
2828
pipdeptree==2.0.0
2929
pycparser==2.20
30-
pygments==2.8.0
30+
pygments==2.8.1
3131
pyparsing==2.4.7
3232
pytz==2021.1
3333
pyyaml==5.4.1
3434
requests==2.25.1
35-
rich==9.12.4
35+
rich==9.13.0
3636
snowballstemmer==2.1.0
3737
sphinx-ansible-theme==0.3.2
3838
sphinx-notfound-page==0.6
3939
sphinx-rtd-theme==0.5.1
40-
sphinx==3.5.1
40+
sphinx==3.5.2
4141
sphinxcontrib-applehelp==1.0.2
4242
sphinxcontrib-devhelp==1.0.2
4343
sphinxcontrib-htmlhelp==1.0.3
4444
sphinxcontrib-jsmath==1.0.1
45+
sphinxcontrib-programoutput2==2.0a1
4546
sphinxcontrib-qthelp==1.0.3
4647
sphinxcontrib-serializinghtml==1.1.4
47-
sphinxcontrib.programoutput==0.16
4848
typing-extensions==3.7.4.3
4949
urllib3==1.26.3
50-
wcmatch==8.1.1
50+
wcmatch==8.1.2
5151

5252
# The following packages are considered to be unsafe in a requirements file:
5353
# pip

docs/usage.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ When you call ansible-lint without arguments the tool will use its internal
7575
heuristics to determine file types.
7676

7777
``ansible-lint`` also accepts a list of **roles** or **playbooks** as
78-
arguments. The following command lints ``examples/play.yml`` and
78+
arguments. The following command lints ``examples/playbooks/play.yml`` and
7979
``examples/roles/bobbins`` role:
8080

81-
.. command-output:: ansible-lint -p examples/play.yml examples/roles/bobbins
81+
.. command-output:: ansible-lint -p examples/playbooks/play.yml examples/roles/bobbins
8282
:cwd: ..
8383
:returncode: 2
8484
:nostderr:
@@ -100,14 +100,14 @@ the following:
100100
If playbooks include other playbooks, or tasks, or handlers or roles, these
101101
are also handled:
102102

103-
.. command-output:: ansible-lint --offline -p examples/playbooks/include.yml
103+
.. command-output:: ansible-lint --force-color --offline -p examples/playbooks/include.yml
104104
:cwd: ..
105105
:returncode: 2
106106
:nostderr:
107107

108108
A codeclimate report in JSON format can be generated with ansible-lint.
109109

110-
.. command-output:: ansible-lint -f codeclimate examples/playbooks/example.yml
110+
.. command-output:: ansible-lint -f codeclimate examples/playbooks/norole.yml
111111
:cwd: ..
112112
:returncode: 2
113113
:nostderr:

test-requirements.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ iniconfig==1.1.1
1717
packaging==20.9
1818
pluggy==0.13.1
1919
py==1.10.0
20-
pygments==2.8.0
20+
pygments==2.8.1
2121
pyparsing==2.4.7
2222
pytest-cov==2.11.1
2323
pytest-forked==1.3.0
2424
pytest-xdist==2.2.1
2525
pytest==6.2.2
2626
pyyaml==5.4.1
27-
rich==9.12.4
27+
rich==9.13.0
2828
toml==0.10.2
2929
typing-extensions==3.7.4.3
30-
wcmatch==8.1.1
30+
wcmatch==8.1.2
3131

3232
# The following packages are considered to be unsafe in a requirements file:
3333
# setuptools

tox.ini

+4
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,15 @@ passenv =
5151
PY_COLORS
5252
REQUESTS_CA_BUNDLE # https proxies
5353
SSL_CERT_FILE # https proxies
54+
LANG
55+
LC_ALL
56+
LC_CTYPE
5457
# recreate = True
5558
setenv =
5659
COVERAGE_FILE = {env:COVERAGE_FILE:{toxworkdir}/.coverage.{envname}}
5760
PIP_DISABLE_PIP_VERSION_CHECK = 1
5861
PRE_COMMIT_COLOR = always
62+
FORCE_COLOR = 1
5963
whitelist_externals =
6064
sh
6165

0 commit comments

Comments
 (0)