aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-framework/tensorflow/files/0001-SyntaxError-around-async-keyword-on-Python-3.7.patch
blob: 75cb5725797fbea8f46507c526664ba46238589f (plain)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
From 8abbdce7a7ec7428b7f657e313ee0b6642c1de76 Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
Date: Thu, 14 Feb 2019 10:45:55 +0800
Subject: [PATCH] SyntaxError around async keyword on Python 3.7

Backport a fix from upstream astor to fix the error

Upstream-Status: Pending

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 tensorflow/workspace.bzl                           |  1 +
 ...-Don-t-use-async-as-a-keyword-argument-94.patch | 79 ++++++++++++++++++++++
 2 files changed, 80 insertions(+)
 create mode 100644 third_party/systemlibs/0001-Don-t-use-async-as-a-keyword-argument-94.patch

diff --git a/tensorflow/workspace.bzl b/tensorflow/workspace.bzl
index aefab03..a281803 100755
--- a/tensorflow/workspace.bzl
+++ b/tensorflow/workspace.bzl
@@ -278,6 +278,7 @@ def tf_workspace(path_prefix = "", tf_repo_name = ""):
     tf_http_archive(
         name = "astor_archive",
         build_file = clean_dep("//third_party:astor.BUILD"),
+        patch_file = clean_dep("//third_party/systemlibs:0001-Don-t-use-async-as-a-keyword-argument-94.patch"),
         sha256 = "ff6d2e2962d834acb125cc4dcc80c54a8c17c253f4cc9d9c43b5102a560bb75d",
         strip_prefix = "astor-0.6.2",
         system_build_file = clean_dep("//third_party/systemlibs:astor.BUILD"),
diff --git a/third_party/systemlibs/0001-Don-t-use-async-as-a-keyword-argument-94.patch b/third_party/systemlibs/0001-Don-t-use-async-as-a-keyword-argument-94.patch
new file mode 100644
index 0000000..aafb172
--- /dev/null
+++ b/third_party/systemlibs/0001-Don-t-use-async-as-a-keyword-argument-94.patch
@@ -0,0 +1,79 @@
+From fe1ef7f9d746847c157197e4cb2ab6505fe19faf Mon Sep 17 00:00:00 2001
+From: Berker Peksag <berker.peksag@gmail.com>
+Date: Fri, 23 Mar 2018 16:50:21 +0300
+Subject: [PATCH] Don't use 'async' as a keyword argument (#94)
+
+Fixes #86
+
+Upstream-Status: Backport[https://github.com/berkerpeksag/astor.git]
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+---
+ astor/code_gen.py | 18 +++++++++---------
+ 1 file changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/astor/code_gen.py b/astor/code_gen.py
+index 7c27f70..47d6acc 100644
+--- a/astor/code_gen.py
++++ b/astor/code_gen.py
+@@ -308,8 +308,8 @@ class SourceGenerator(ExplicitNodeVisitor):
+         self.statement(node)
+         self.generic_visit(node)
+ 
+-    def visit_FunctionDef(self, node, async=False):
+-        prefix = 'async ' if async else ''
++    def visit_FunctionDef(self, node, is_async=False):
++        prefix = 'async ' if is_async else ''
+         self.decorators(node, 1 if self.indentation else 2)
+         self.statement(node, '%sdef %s' % (prefix, node.name), '(')
+         self.visit_arguments(node.args)
+@@ -322,7 +322,7 @@ class SourceGenerator(ExplicitNodeVisitor):
+ 
+     # introduced in Python 3.5
+     def visit_AsyncFunctionDef(self, node):
+-        self.visit_FunctionDef(node, async=True)
++        self.visit_FunctionDef(node, is_async=True)
+ 
+     def visit_ClassDef(self, node):
+         have_args = []
+@@ -364,24 +364,24 @@ class SourceGenerator(ExplicitNodeVisitor):
+                 self.else_body(else_)
+                 break
+ 
+-    def visit_For(self, node, async=False):
++    def visit_For(self, node, is_async=False):
+         set_precedence(node, node.target)
+-        prefix = 'async ' if async else ''
++        prefix = 'async ' if is_async else ''
+         self.statement(node, '%sfor ' % prefix,
+                        node.target, ' in ', node.iter, ':')
+         self.body_or_else(node)
+ 
+     # introduced in Python 3.5
+     def visit_AsyncFor(self, node):
+-        self.visit_For(node, async=True)
++        self.visit_For(node, is_async=True)
+ 
+     def visit_While(self, node):
+         set_precedence(node, node.test)
+         self.statement(node, 'while ', node.test, ':')
+         self.body_or_else(node)
+ 
+-    def visit_With(self, node, async=False):
+-        prefix = 'async ' if async else ''
++    def visit_With(self, node, is_async=False):
++        prefix = 'async ' if is_async else ''
+         self.statement(node, '%swith ' % prefix)
+         if hasattr(node, "context_expr"):  # Python < 3.3
+             self.visit_withitem(node)
+@@ -392,7 +392,7 @@ class SourceGenerator(ExplicitNodeVisitor):
+ 
+     # new for Python 3.5
+     def visit_AsyncWith(self, node):
+-        self.visit_With(node, async=True)
++        self.visit_With(node, is_async=True)
+ 
+     # new for Python 3.3
+     def visit_withitem(self, node):
+-- 
+2.7.4
+
-- 
2.7.4