saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Install Salt from the Salt package repositories here:
https://docs.saltproject.io/salt/install-guide/en/latest/
Apache License 2.0
14.19k stars 5.48k forks source link

Embedded Tornado contains Py 3.7 keywords which need to be removed #56018

Closed dmurphy18 closed 4 years ago

dmurphy18 commented 4 years ago

Description of Issue

Embedded Tornado contains Py 3.7 keywords which need to be removed

Setup

(Please provide relevant configs and/or SLS files (Be sure to remove sensitive info).)

Steps to Reproduce Issue

From a slack conversation:

Think you missed one on the ext.tornado,, building on Amazon Linux 2 Py 3 which is 3.7
5466 /usr/lib/rpm/sepdebugcrcfix: Updated 0 CRC32s, 0 CRC32s did match.
5467 BUILDSTDERR: find: 'debug': No such file or directory
5468 + /usr/lib/rpm/check-buildroot
5469 + /usr/lib/rpm/redhat/brp-compress
5470 + /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
5471 + /usr/lib/rpm/brp-python-bytecompile /usr/bin/python 1
5472 Bytecompiling .py files below /builddir/build/BUILDROOT/salt-2999.0.0nb202001290009059414103-0.amzn2.x86_64/usr/lib/python3.7 using /usr/bin/python3.7
5473 *** Error compiling '/builddir/build/BUILDROOT/salt-2999.0.0nb202001290009059414103-0.amzn2.x86_64/usr/lib/python3.7/site-packages/salt/ext/tornado/test/asyncio_test.py'...
5474   File "/usr/lib/python3.7/asyncio_test.py", line 50
5475     ensure_future = asyncio.async
5476                                 ^
5477 SyntaxError: invalid syntax
5478 BUILDSTDERR: error: Bad exit status from /var/tmp/rpm-tmp.24mNaY (%install)
5479 BUILDSTDERR:     Bad exit status from /var/tmp/rpm-tmp.24mNaY (%install)
5480 RPM build errors:
5481 Child return code was: 1
5482 EXCEPTION: [Error()]
5483 Traceback (most recent call last):
5484   File "/usr/lib/python3.7/site-packages/mockbuild/trace_decorator.py", line 96, in trace
5485     result = func(*args, **kw)
5486   File "/usr/lib/python3.7/site-packages/mockbuild/util.py", line 734, in do_with_status
5487     raise exception.Error("Command failed: \n # %s\n%s" % (command, output), child.returncode)
5488 mockbuild.exception.Error: Command failed:
got an asyncio keyword

Versions Report

(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)

dmurphy18 commented 4 years ago

Need to apply the following:

From: Benjamin Drung <benjamin.drung@cloud.ionos.com>
Date: Thu, 15 Nov 2018 16:18:51 +0100
Subject: [PATCH] Add support for Python 3.7
---
 tornado/gen.py               | 3 +--
 tornado/queues.py            | 1 -
 tornado/test/asyncio_test.py | 3 ++-
 3 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/tornado/gen.py b/tornado/gen.py
index 99f9106..bdb32ff 100644
--- a/tornado/gen.py
+++ b/tornado/gen.py
@@ -482,9 +482,8 @@ class WaitIterator(object):
         self.current_future = done
         self.current_index = self._unfinished.pop(done)
-    @coroutine
     def __aiter__(self):
-        raise Return(self)
+        return self
     def __anext__(self):
         if self.done():
diff --git a/tornado/queues.py b/tornado/queues.py
index 0041a80..141c539 100644
--- a/tornado/queues.py
+++ b/tornado/queues.py
@@ -253,7 +253,6 @@ class Queue(object):
         """
         return self._finished.wait(timeout)
-    @gen.coroutine
     def __aiter__(self):
         return _QueueIterator(self)
diff --git a/tornado/test/asyncio_test.py b/tornado/test/asyncio_test.py
index d0e3f2b..ae9125f 100644
--- a/tornado/test/asyncio_test.py
+++ b/tornado/test/asyncio_test.py
@@ -46,7 +46,8 @@ class AsyncIOLoopTest(AsyncTestCase):
         if hasattr(asyncio, 'ensure_future'):
             ensure_future = asyncio.ensure_future
         else:
-            ensure_future = asyncio.async
+            # async is a reserved word in Python 3.7
+            ensure_future = getattr(asyncio, "async")
         x = yield ensure_future(
             asyncio.get_event_loop().run_in_executor(None, lambda: 42))
dmurphy18 commented 4 years ago

PR merged, closing