public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH proxmox-backup] python3.12 compat: docs/_ext/proxmox-scanrefs.py: cast to string for re.sub()
@ 2024-12-16  9:37 Jing Luo via pve-devel
  0 siblings, 0 replies; only message in thread
From: Jing Luo via pve-devel @ 2024-12-16  9:37 UTC (permalink / raw)
  To: pve-devel; +Cc: Jing Luo

[-- Attachment #1: Type: message/rfc822, Size: 7571 bytes --]

From: Jing Luo <jing@jing.rocks>
To: pve-devel@lists.proxmox.com
Cc: Jing Luo <jing@jing.rocks>
Subject: [PATCH proxmox-backup] python3.12 compat: docs/_ext/proxmox-scanrefs.py: cast to string for re.sub()
Date: Mon, 16 Dec 2024 18:37:45 +0900
Message-ID: <20241216093744.3324807-2-jing@jing.rocks>

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@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




[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-12-16  9:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-16  9:37 [pve-devel] [PATCH proxmox-backup] python3.12 compat: docs/_ext/proxmox-scanrefs.py: cast to string for re.sub() Jing Luo via pve-devel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal