File: astroid-4.patch

package info (click to toggle)
python-sphinx-autodoc2 0.5.0-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,304 kB
  • sloc: python: 3,418; xml: 72; makefile: 7
file content (49 lines) | stat: -rw-r--r-- 1,619 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
From: Colin Watson <cjwatson@debian.org>
Date: Tue, 16 Dec 2025 16:57:50 +0000
Subject: Support astroid 4

This is useful because astroid 4 added support for Python 3.14.

Forwarded: https://github.com/sphinx-extensions2/sphinx-autodoc2/pull/93
Last-Update: 2025-12-16
---
 pyproject.toml           | 2 +-
 src/autodoc2/analysis.py | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/pyproject.toml b/pyproject.toml
index 9a6f9ea..823a818 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -19,7 +19,7 @@ keywords = ["sphinx", "autodoc", "extension", "documentation"]
 urls = {Home = "https://github.com/chrisjsewell/sphinx-autodoc2"}
 requires-python = ">=3.8"
 dependencies = [
-    "astroid>=2.7,<4",
+    "astroid>=2.7,<5",
     "tomli; python_version<'3.11'",
     "typing-extensions"
 ]
diff --git a/src/autodoc2/analysis.py b/src/autodoc2/analysis.py
index 1ee6ba9..5bb799a 100644
--- a/src/autodoc2/analysis.py
+++ b/src/autodoc2/analysis.py
@@ -14,6 +14,7 @@ import typing as t
 
 from astroid import nodes
 from astroid.builder import AstroidBuilder
+from astroid.manager import AstroidManager
 
 from . import astroid_utils
 
@@ -37,7 +38,9 @@ def analyse_module(
         you can use this to record them.
     """
     # TODO expose record_external_imports everywhere analyse_module is used
-    node = AstroidBuilder().file_build(os.fsdecode(file_path), name)
+    node = AstroidBuilder(manager=AstroidManager()).file_build(
+        os.fsdecode(file_path), name
+    )
     yield from walk_node(
         node, State(node.name.split(".", 1)[0], [], exclude_external_imports)
     )