File: fix-ast-constant-for-python3.14.patch

package info (click to toggle)
python-django-compressor 4.5.1-5
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,124 kB
  • sloc: python: 4,906; makefile: 123; javascript: 5
file content (24 lines) | stat: -rw-r--r-- 815 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
Description: fix-ast-constant-for-python3.14.patch
Author: Thomas Goirand <zigo@debian.org>
Bug-Debian: https://bugs.debian.org/1122463
Forwarded: not-needed
Last-Update: 2025-12-22

--- python-django-compressor-4.5.1.orig/setup.py
+++ python-django-compressor-4.5.1/setup.py
@@ -14,8 +14,13 @@ class VersionFinder(ast.NodeVisitor):
 
     def visit_Assign(self, node):
         if node.targets[0].id == "__version__":
-            self.version = node.value.s
-
+            val = node.value
+            if hasattr(val, "s"):
+                self.version = val.s
+            elif isinstance(val, ast.Constant) and isinstance(val.value, str):
+                self.version = val.value
+            else:
+                return
 
 def read(*parts):
     filename = os.path.join(os.path.dirname(__file__), *parts)