[PATCH proxmox-backup] python3.12 compat: docs/_ext/proxmox-scanrefs.py: cast to string for re.sub()
Jing Luo
jing at jing.rocks
Mon Dec 16 10:37:45 CET 2024
This fixes a FTBFS with python 3.12. We need to cast "filename" to string.
Sphinx version: 8.1.3
Python version: 3.12.8 (CPython)
Docutils version: 0.21.2
Jinja2 version: 3.1.3
Pygments version: 2.18.0
Last messages:
copying assets...
copying assets: done
writing output... [ 1%]
GFDL
writing output... [ 2%]
backup-client
Loaded extensions:
sphinx.ext.mathjax (8.1.3)
alabaster (0.7.16)
sphinx.ext.graphviz (8.1.3)
sphinx.ext.todo (8.1.3)
proxmox-scanrefs (0.1)
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/sphinx/cmd/build.py", line 514, in build_main
app.build(args.force_all, args.filenames)
File "/usr/lib/python3/dist-packages/sphinx/application.py", line 380, in build
self.builder.build_update()
File "/usr/lib/python3/dist-packages/sphinx/builders/__init__.py", line 355, in build_update
self.build(['__all__'], to_build)
File "/usr/lib/python3/dist-packages/sphinx/builders/__init__.py", line 437, in build
self.write(docnames, list(updated_docnames), method)
File "/usr/lib/python3/dist-packages/sphinx/builders/__init__.py", line 711, in write
self.write_documents(docnames)
File "/usr/lib/python3/dist-packages/sphinx/builders/__init__.py", line 725, in write_documents
self._write_serial(sorted_docnames)
File "/usr/lib/python3/dist-packages/sphinx/builders/__init__.py", line 744, in _write_serial
self.write_doc(docname, doctree)
File "/home/jing/proxmox-backup/build/docs/_ext/proxmox-scanrefs.py", line 92, in write_doc
filename_html = re.sub('.rst', '.html', filename)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/re/__init__.py", line 186, in sub
return _compile(pattern, flags).sub(repl, string, count)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected string or bytes-like object, got '_StrPath'
Signed-off-by: Jing Luo <jing at jing.rocks>
---
docs/_ext/proxmox-scanrefs.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/_ext/proxmox-scanrefs.py b/docs/_ext/proxmox-scanrefs.py
index 0d626561..680035e0 100644
--- a/docs/_ext/proxmox-scanrefs.py
+++ b/docs/_ext/proxmox-scanrefs.py
@@ -89,7 +89,7 @@ class ReflabelMapper(Builder):
if hasattr(node, 'expect_referenced_by_id') and len(node['ids']) > 1: # explicit labels
filename = self.env.doc2path(docname)
- filename_html = re.sub('.rst', '.html', filename)
+ filename_html = re.sub('.rst', '.html', str(filename))
# node['ids'][0] contains a normalized version of the
# headline. If the ref and headline are the same
--
2.47.1
More information about the pve-devel
mailing list