From 79d9701a005db6aee2edaa330f6339031bb433d8 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Mon, 17 May 2021 23:18:00 +0900 Subject: [PATCH] Fix #9217: manpage: Dirname of man_make_section_directory is wrong * Correct: man/man1 * Wrong: man/1 --- CHANGES | 2 ++ sphinx/builders/manpage.py | 5 +++-- tests/test_build_manpage.py | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index ac0f64cb9..5ede9f9a3 100644 --- a/CHANGES +++ b/CHANGES @@ -51,6 +51,8 @@ Bugs fixed * #8597: autodoc: a docsting having metadata only should be treated as undocumented * #9185: autodoc: typehints for overloaded functions and methods are inaccurate +* #9217: manpage: The name of manpage directory that is generated by + :confval:`man_make_section_directory` is not correct Testing -------- diff --git a/sphinx/builders/manpage.py b/sphinx/builders/manpage.py index 532d2b8fe..9d8fd5e67 100644 --- a/sphinx/builders/manpage.py +++ b/sphinx/builders/manpage.py @@ -79,8 +79,9 @@ class ManualPageBuilder(Builder): docsettings.section = section if self.config.man_make_section_directory: - ensuredir(path.join(self.outdir, str(section))) - targetname = '%s/%s.%s' % (section, name, section) + dirname = 'man%s' % section + ensuredir(path.join(self.outdir, dirname)) + targetname = '%s/%s.%s' % (dirname, name, section) else: targetname = '%s.%s' % (name, section) diff --git a/tests/test_build_manpage.py b/tests/test_build_manpage.py index a017abc69..0b7ce2396 100644 --- a/tests/test_build_manpage.py +++ b/tests/test_build_manpage.py @@ -34,7 +34,7 @@ def test_all(app, status, warning): confoverrides={'man_make_section_directory': True}) def test_man_make_section_directory(app, status, warning): app.build() - assert (app.outdir / '1' / 'python.1').exists() + assert (app.outdir / 'man1' / 'python.1').exists() @pytest.mark.sphinx('man', testroot='directive-code')