all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Jing Luo via pve-devel <pve-devel@lists.proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Jing Luo <jing@jing.rocks>
Subject: [pve-devel] [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	[thread overview]
Message-ID: <mailman.223.1734341954.332.pve-devel@lists.proxmox.com> (raw)

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

                 reply	other threads:[~2024-12-16  9:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mailman.223.1734341954.332.pve-devel@lists.proxmox.com \
    --to=pve-devel@lists.proxmox.com \
    --cc=jing@jing.rocks \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal