Skip to content

Commit 7c712bf

Browse files
committed
🔧 build(man): add tox manpage env for regeneration
1 parent 757dc9f commit 7c712bf

File tree

3 files changed

+11
-18
lines changed

3 files changed

+11
-18
lines changed

docs/how-to/install.rst

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -112,25 +112,10 @@ system ``MANPATH``. Use the ``tox man`` command to set it up:
112112
Building from Source
113113
====================
114114

115-
The man page is compiled from ``docs/man/tox.1.rst`` during wheel build. Package maintainers building from source can
116-
generate the troff file directly:
115+
The man page is compiled from ``docs/man/tox.1.rst`` during wheel build. To regenerate the RST source after CLI changes:
117116

118117
.. code-block:: bash
119118
120-
python -c "
121-
from docutils.core import publish_string
122-
from pathlib import Path
123-
rst = Path('docs/man/tox.1.rst').read_text()
124-
content = '\n'.join(l for l in rst.splitlines() if l.strip() != ':orphan:')
125-
Path('tox.1').write_bytes(publish_string(content, writer='manpage', settings_overrides={'report_level': 5}))
126-
"
127-
install -D -m 644 tox.1 /usr/share/man/man1/tox.1
128-
gzip -9 /usr/share/man/man1/tox.1
129-
130-
To regenerate the RST source after CLI changes:
131-
132-
.. code-block:: bash
133-
134-
python tools/generate_manpage.py
119+
tox run -e manpage
135120
136121
After installation, view with ``man tox``.

docs/reference/cli.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ environment names (``tox run -e`` lists environments from your tox configuration
5151
**********
5252

5353
tox ships a Unix man page accessible via ``man tox`` (see :ref:`howto` for setup). The man page source is at
54-
``docs/man/tox.1.rst`` and can be regenerated from the CLI parser with ``python tools/generate_manpage.py``.
54+
``docs/man/tox.1.rst`` and can be regenerated from the CLI parser with ``tox run -e manpage``.
5555

5656
**********************
5757
Command-line options

tox.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,14 @@ dependency_groups = [ "dev" ]
144144
commands = [ [ "python", "-m", "pip", "list", "--format=columns" ], [ "python", "-c", 'print(r"{env_python}")' ] ]
145145
uv_seed = true
146146

147+
[env.manpage]
148+
description = "generate the manpage RST from the CLI parser"
149+
package = "editable"
150+
skip_install = false
151+
extras = [ "completion" ]
152+
dependency_groups = [ "docs" ]
153+
commands = [ [ "python", "{tox_root}/tools/generate_manpage.py" ] ]
154+
147155
[env.fast]
148156
description = "fast test run for development (no integration, no slow tests, no coverage)"
149157
package = "editable"

0 commit comments

Comments
 (0)