File: 2200-remove-astunparse-dep.patch

package info (click to toggle)
pytorch-cuda 2.6.0%2Bdfsg-7
  • links: PTS, VCS
  • area: contrib
  • in suites: forky, sid, trixie
  • size: 161,620 kB
  • sloc: python: 1,278,832; cpp: 900,322; ansic: 82,710; asm: 7,754; java: 3,363; sh: 2,811; javascript: 2,443; makefile: 597; ruby: 195; xml: 84; objc: 68
file content (72 lines) | stat: -rw-r--r-- 2,758 bytes parent folder | download | duplicates (3)
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Description: Remove dependency on astunparse
 It has been replaced with ast.unparse since Python 3.9.
Author: Shengqi Chen <harry-chen@outlook.com>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1086773
Forwarded: not-needed
 Upstream needs it to support python 3.8.
Last-Update: 2024-11-06
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
Index: pytorch/benchmarks/dynamo/Makefile
===================================================================
--- pytorch.orig/benchmarks/dynamo/Makefile
+++ pytorch/benchmarks/dynamo/Makefile
@@ -27,7 +27,7 @@ build-deps: clone-deps
 	# conda env remove --name torchdynamo
 	# conda create --name torchdynamo -y python=3.8
 	# conda activate torchdynamo
-	conda install -y astunparse numpy scipy ninja pyyaml mkl mkl-include setuptools cmake \
+	conda install -y numpy scipy ninja pyyaml mkl mkl-include setuptools cmake \
 		typing-extensions requests protobuf numba cython scikit-learn
 	conda install -y -c pytorch magma-cuda116
 	conda install -y -c conda-forge librosa
Index: pytorch/pyproject.toml
===================================================================
--- pytorch.orig/pyproject.toml
+++ pytorch/pyproject.toml
@@ -2,7 +2,6 @@
 requires = [
     "setuptools",
     "wheel",
-    "astunparse",
     "numpy",
     "ninja",
     "pyyaml",
Index: pytorch/requirements.txt
===================================================================
--- pytorch.orig/requirements.txt
+++ pytorch/requirements.txt
@@ -1,5 +1,4 @@
 # Python dependencies required for development
-astunparse
 expecttest>=0.2.1
 hypothesis
 numpy
Index: pytorch/torch/jit/frontend.py
===================================================================
--- pytorch.orig/torch/jit/frontend.py
+++ pytorch/torch/jit/frontend.py
@@ -74,13 +74,7 @@ from torch.jit._dataclass_impls import D
 from torch.jit._monkeytype_config import get_qualified_name, monkeytype_trace
 
 
-_IS_ASTUNPARSE_INSTALLED = False
-try:
-    import astunparse  # type: ignore[import]
-
-    _IS_ASTUNPARSE_INSTALLED = True
-except ImportError:
-    pass
+_IS_ASTUNPARSE_INSTALLED = True
 
 # Borrowed from cPython implementation
 # https://github.com/python/cpython/blob/561612d8456cfab5672c9b445521113b847bd6b3/Lib/textwrap.py#L411#
@@ -583,7 +577,7 @@ def build_ignore_context_manager(ctx, st
     ignore_function.body.append(return_stmt)  # type: ignore[attr-defined]
 
     # registers the custom function in the global context
-    ignore_func_str = "@torch.jit.ignore\n" + astunparse.unparse(ignore_function)
+    ignore_func_str = "@torch.jit.ignore\n" + ast.unparse(ignore_function)
     ignore_func_str += f'\nglobals()["{ignore_function_name}"] = {ignore_function_name}'
     exec(ignore_func_str)  # noqa: P204