From cfb17cac163b97d56bd33f1e6e9748547002a6f9 Mon Sep 17 00:00:00 2001
From: Jamie Magee <JamieMagee@users.noreply.github.com>
Date: Tue, 19 Nov 2019 09:13:32 +0100
Subject: [PATCH] build: python 3.8 support (#4797)

See microsoft/azure-pipelines-image-generation#1317

Fixes #4775, Fixes #4657
---
 Dockerfile                                       |  6 +++---
 azure-pipelines.yml                              | 16 ++++++++--------
 docs/development/local-development.md            |  2 +-
 lib/manager/pip_setup/extract.ts                 |  2 +-
 .../pip_setup/__snapshots__/extract.spec.ts.snap |  2 +-
 5 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index cafe069cd2..1e5c5d43d3 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -137,11 +137,11 @@ ENV CGO_ENABLED=0
 
 # Python
 
-RUN apt-get update && apt-get install -y python3.7-dev python3-distutils && \
+RUN apt-get update && apt-get install -y python3.8-dev python3-distutils && \
     rm -rf /var/lib/apt/lists/*
 
-RUN rm -fr /usr/bin/python3 && ln /usr/bin/python3.7 /usr/bin/python3
-RUN rm -rf /usr/bin/python && ln /usr/bin/python3.7 /usr/bin/python
+RUN rm -fr /usr/bin/python3 && ln /usr/bin/python3.8 /usr/bin/python3
+RUN rm -rf /usr/bin/python && ln /usr/bin/python3.8 /usr/bin/python
 
 # Pip
 
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 580ca99052..5d8df33313 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -18,12 +18,12 @@ jobs:
   - job: 'Windows'
     strategy:
       matrix:
-        Node10 Py3.7:
+        Node10 Py3.8:
           nodeVersion: '10.x'
-          pythonVersion: '3.7'
-        Node12 Py3.7:
+          pythonVersion: '3.8'
+        Node12 Py3.8:
           nodeVersion: '12.x'
-          pythonVersion: '3.7'
+          pythonVersion: '3.8'
     pool:
       vmImage: windows-2019
     steps:
@@ -38,9 +38,9 @@ jobs:
   - job: 'Linux'
     strategy:
       matrix:
-        Node10 Py3.7:
+        Node10 Py3.8:
           nodeVersion: '10.x'
-          pythonVersion: '3.7'
+          pythonVersion: '3.8'
     pool:
       vmImage: ubuntu-18.04
     steps:
@@ -49,9 +49,9 @@ jobs:
   - job: 'MacOS'
     strategy:
       matrix:
-        Node10 Py3.7:
+        Node10 Py3.8:
           nodeVersion: '10.x'
-          pythonVersion: '3.7'
+          pythonVersion: '3.8'
     pool:
       vmImage: macOS-10.13
 
diff --git a/docs/development/local-development.md b/docs/development/local-development.md
index 7013090c0d..c060902e51 100644
--- a/docs/development/local-development.md
+++ b/docs/development/local-development.md
@@ -124,7 +124,7 @@ You can run just the Jest unit tests by running `yarn jest`. You can also run ju
 
 #### Prerequisites
 
-You need to have Python with `mock` installed for all tests to pass. Version 3.7 of Python includes `mock` so that approach is recommended.
+You need to have Python with `mock` installed for all tests to pass. Python 3 includes `mock` so that approach is recommended.
 
 You also need to make sure that you don't have a local `.npmrc` file that overrides npm's default registry.
 
diff --git a/lib/manager/pip_setup/extract.ts b/lib/manager/pip_setup/extract.ts
index fde3a15c72..f3c7395127 100644
--- a/lib/manager/pip_setup/extract.ts
+++ b/lib/manager/pip_setup/extract.ts
@@ -5,7 +5,7 @@ import { isSkipComment } from '../../util/ignore';
 import { dependencyPattern } from '../pip_requirements/extract';
 import { ExtractConfig, PackageFile, PackageDependency } from '../common';
 
-export const pythonVersions = ['python', 'python3', 'python3.7'];
+export const pythonVersions = ['python', 'python3', 'python3.8'];
 let pythonAlias: string | null = null;
 
 export function parsePythonVersion(str: string): number[] {
diff --git a/test/manager/pip_setup/__snapshots__/extract.spec.ts.snap b/test/manager/pip_setup/__snapshots__/extract.spec.ts.snap
index 393c2d8ae4..5252271583 100644
--- a/test/manager/pip_setup/__snapshots__/extract.spec.ts.snap
+++ b/test/manager/pip_setup/__snapshots__/extract.spec.ts.snap
@@ -138,7 +138,7 @@ exports[`lib/manager/pip_setup/extract getPythonAlias finds python 1`] = `
       "python3 --version",
     ],
     Array [
-      "python3.7 --version",
+      "python3.8 --version",
     ],
   ],
   "results": Array [
-- 
GitLab