From 6957fb1573c2df28601a3d21eda63fc1d981faf0 Mon Sep 17 00:00:00 2001 From: Ryan Roberts Date: Fri, 16 Dec 2022 16:31:23 +0000 Subject: [PATCH] core: Add support for Python 3.6.9 Previously we were restricting support to Python 3.7.0 and newer, due to that version being the first to support ordered dicts, which are relied upon to pretify generated config files. However it turns out that Python 3.6 implements ordered dicts despite that version of the language not requiring it. Ubuntu 18.04 ships with Python 3.6.9 by default and a number of people are still using that release, so let's support that as the minimum version. In order for it to work, there are a few mods we have to make to API calls etc. Signed-off-by: Ryan Roberts --- documentation/userguide/quickstart.rst | 4 ++-- shrinkwrap/utils/process.py | 2 +- shrinkwrap/utils/runtime.py | 5 ++++- test/test.py | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/documentation/userguide/quickstart.rst b/documentation/userguide/quickstart.rst index 12a3fc6..c139f4b 100644 --- a/documentation/userguide/quickstart.rst +++ b/documentation/userguide/quickstart.rst @@ -18,8 +18,8 @@ Shrinkwrap is tested on **Ubuntu 20.04** although other Linux distributions are likely to JustWork (TM). macOS is also known to work when using the docker runtime as long as Docker Desktop has first been installed. -Shrinkwrap requires **at least Python 3.7** (for ordered dicts). Older versions -may work, but are not tested. +Shrinkwrap requires **at least Python 3.6.9**. Older versions may work, but are +not tested. .. code-block:: shell diff --git a/shrinkwrap/utils/process.py b/shrinkwrap/utils/process.py index 5b6777b..d238412 100644 --- a/shrinkwrap/utils/process.py +++ b/shrinkwrap/utils/process.py @@ -132,7 +132,7 @@ class ProcessManager: stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.PIPE, - text=True) + universal_newlines=True) proc._stdin = None proc._stdout = proc._popen.stdout diff --git a/shrinkwrap/utils/runtime.py b/shrinkwrap/utils/runtime.py index 0f80cc7..872a4a0 100644 --- a/shrinkwrap/utils/runtime.py +++ b/shrinkwrap/utils/runtime.py @@ -65,7 +65,10 @@ print(ip) """.replace('\n', '\\n').replace('\t', '\\t') cmd = ['python3', '-c', f'exec("{script}")'] - res = subprocess.run(self.mkcmd(cmd), text=True, capture_output=True) + res = subprocess.run(self.mkcmd(cmd), + universal_newlines=True, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) if res.returncode == 0: return res.stdout.strip() return '127.0.0.1' diff --git a/test/test.py b/test/test.py index 6a15efa..8d8f677 100755 --- a/test/test.py +++ b/test/test.py @@ -50,7 +50,7 @@ def print_result(r): def report(status, type, config, overlay): desc = f'{status.upper()}: {type}: {config},{overlay}' count = (1, 0) if status == 'pass' else (0, 1) - return *count, desc + return count[0], count[1], desc if r['type'] == 'build': configs = r['configs'] -- GitLab