cobbler/backport-Fix-package-building-with-Sphinx.patch
zhangpan ce542d4f73 fix build fail
(cherry picked from commit f06273b36484c998fcef9e84eac6a3aa8d7fc415)
2023-08-11 15:06:36 +08:00

101 lines
3.2 KiB
Diff

From 8a94846b133f12c71f515b0fbaa834b37dd00347 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
<psuarezhernandez@suse.com>
Date: Wed, 17 May 2023 13:33:37 +0100
Subject: [PATCH] Fix package building with Sphinx >= 7.0.0
Sphinx has dropped the integration with setuptools in version 7.0.0:
https://www.sphinx-doc.org/en/master/changes.html#release-7-0-0-released-apr-29-2023
We now build documentation and man pages out of setup.py script
---
Makefile | 3 +++
cobbler.spec | 1 +
setup.py | 22 +---------------------
3 files changed, 5 insertions(+), 21 deletions(-)
diff --git a/Makefile b/Makefile
index 1174062..541865c 100644
--- a/Makefile
+++ b/Makefile
@@ -53,6 +53,9 @@ doc: ## Creates the documentation with sphinx in html form.
@echo "creating: documentation"
@cd docs; make html > /dev/null 2>&1
+man: ## Creates documentation and man pages using Sphinx
+ @${PYTHON} -m sphinx -b man -j auto ./docs ./build/sphinx/man
+
qa: ## If pyflakes and/or pycodestyle is found then they are run.
ifeq ($(strip $(PYFLAKES)),)
@echo "No pyflakes found"
diff --git a/cobbler.spec b/cobbler.spec
index 1235917..e4c482b 100644
--- a/cobbler.spec
+++ b/cobbler.spec
@@ -307,6 +307,7 @@ echo "ERROR: DOCPATH: ${DOCPATH} does not match %{_mandir}"
[ "${TFTPROOT}" != %{tftpboot_dir} ] && echo "ERROR: TFTPROOT: ${TFTPROOT} does not match %{tftpboot_dir}"
%py3_build
+make man
%install
. distro_build_configs.sh
diff --git a/setup.py b/setup.py
index 57d8543..595ffd0 100644
--- a/setup.py
+++ b/setup.py
@@ -16,7 +16,6 @@ from setuptools import dep_util
from distutils.command.build import build as _build
from configparser import ConfigParser
from setuptools import find_packages
-from sphinx.setup_command import BuildDoc
import codecs
from coverage import Coverage
@@ -143,15 +142,6 @@ class build(_build):
def run(self):
_build.run(self)
-#####################################################################
-# # Build man pages using Sphinx ###################################
-#####################################################################
-
-
-class build_man(BuildDoc):
- def initialize_options(self):
- BuildDoc.initialize_options(self)
- self.builder = 'man'
#####################################################################
# # Configure files ##################################################
@@ -279,16 +269,7 @@ def has_configure_files(build):
return bool(build.distribution.configure_files)
-def has_man_pages(build):
- """Check if the distribution has configuration files to work on."""
- return bool(build.distribution.man_pages)
-
-
-build.sub_commands.extend((
- ('build_man', has_man_pages),
- ('build_cfg', has_configure_files)
-))
-
+build.sub_commands.extend((("build_cfg", has_configure_files),))
#####################################################################
# # Modify Install Stage ############################################
@@ -490,7 +471,6 @@ if __name__ == "__main__":
'savestate': savestate,
'restorestate': restorestate,
'build_cfg': build_cfg,
- 'build_man': build_man
},
name="cobbler",
version=VERSION,
--
2.27.0