From 64d84ff9d2c96cb3624e6684bf2694d0dc49868a Mon Sep 17 00:00:00 2001
From: Michael Kriese <michael.kriese@visualon.de>
Date: Fri, 8 May 2020 16:59:11 +0200
Subject: [PATCH] test: require python ^3.7 (#6168)

---
 .github/workflows/build.yml           | 27 +----------------------
 .github/workflows/release-npm.yml     |  3 ---
 docs/development/local-development.md | 31 ++++++++-------------------
 requirements.txt                      |  1 -
 4 files changed, 10 insertions(+), 52 deletions(-)
 delete mode 100644 requirements.txt

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 28237b1503..b5f0bfe6d8 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -9,12 +9,10 @@ on:
   pull_request:
 
 env:
-  CI: true
   DOCKER_REPO: renovate/renovate
   YARN_MODULES_CACHE_KEY: v1
   YARN_PACKAGE_CACHE_KEY: v1
   YARN_CACHE_FOLDER: .cache/yarn
-  BUILDX_VERSION: v0.3.1
   NODE_VERSION: 12
   # https://github.com/chalk/supports-color/issues/106
   FORCE_COLOR: true
@@ -78,10 +76,8 @@ jobs:
         run: echo "::set-env name=SKIP_JAVA_TESTS::true"
 
       - name: Init platform
-        id: init
         shell: bash
         run: |
-          python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=pip_cache::' + USER_CACHE_DIR)"
           git config --global core.autocrlf false
           git config --global core.symlinks true
           git config --global user.email 'bot@renovateapp.com'
@@ -90,7 +86,6 @@ jobs:
           echo "Node $(node --version)"
           python --version
           echo "Yarn $(yarn --version)"
-          pip --version
 
       - uses: actions/checkout@v2
 
@@ -111,29 +106,13 @@ jobs:
           restore-keys: |
             ${{ env.YARN_MODULES_CACHE_KEY }}-${{ runner.os }}-${{ env.NODE_VERSION }}-yarn-
 
-      - name: Cache pip packages
-        id: pip_cache_packages
-        uses: actions/cache@v1
-        with:
-          path: ${{ steps.init.outputs.pip_cache }}
-          key: ${{ runner.os }}-${{ env.PYTHON_VERSION }}-pip-${{ hashFiles('**/requirements.txt') }}
-          restore-keys: |
-            ${{ runner.os }}-${{ env.PYTHON_VERSION }}-pip-
-
       # Clear caches on cache miss, otherwise they will grow indefinitely
       - name: Clear yarn cache
         if: steps.yarn_cache_packages.outputs.cache-hit != 'true'
         run: yarn cache clean
 
-      - name: Clear pip cache
-        if: steps.pip_cache_packages.outputs.cache-hit != 'true'
-        run: python -c "from pip._internal.locations import USER_CACHE_DIR; from shutil import rmtree; rmtree(USER_CACHE_DIR, ignore_errors=True)"
-
       - name: Installing dependencies
-        run: |
-          python -m pip install --upgrade pip
-          yarn install --frozen-lockfile --link-duplicates
-          pip install --user -r requirements.txt
+        run: yarn install --frozen-lockfile --link-duplicates
 
       - name: Build
         run: yarn build
@@ -173,8 +152,6 @@ jobs:
           node-version: ${{ env.NODE_VERSION }}
 
       - name: Init platform
-        id: init
-        shell: bash
         run: |
           git config --global core.autocrlf false
           git config --global core.symlinks true
@@ -182,7 +159,6 @@ jobs:
           git config --global user.name  'Renovate Bot'
           npm config set scripts-prepend-node-path true
           echo "Node $(node --version)"
-          python --version
           echo "Yarn $(yarn --version)"
 
       - uses: actions/checkout@v2
@@ -236,7 +212,6 @@ jobs:
           node-version: ${{ env.NODE_VERSION }}
 
       - name: Init platform
-        id: init
         run: |
           git config --global core.autocrlf false
           git config --global core.symlinks true
diff --git a/.github/workflows/release-npm.yml b/.github/workflows/release-npm.yml
index 6c27f6972c..e849ec245e 100644
--- a/.github/workflows/release-npm.yml
+++ b/.github/workflows/release-npm.yml
@@ -4,11 +4,9 @@ on:
     types: [renovate-release]
 
 env:
-  CI: true
   YARN_MODULES_CACHE_KEY: v1
   YARN_PACKAGE_CACHE_KEY: v1
   YARN_CACHE_FOLDER: .cache/yarn
-  BUILDX_VERSION: v0.3.1
   NODE_VERSION: 12
   # https://github.com/chalk/supports-color/issues/106
   FORCE_COLOR: true
@@ -23,7 +21,6 @@ jobs:
           node-version: ${{ env.NODE_VERSION }}
 
       - name: Init platform
-        id: init
         run: |
           git config --global core.autocrlf false
           git config --global core.symlinks true
diff --git a/docs/development/local-development.md b/docs/development/local-development.md
index fad828548e..8cbd1fabe4 100644
--- a/docs/development/local-development.md
+++ b/docs/development/local-development.md
@@ -3,14 +3,6 @@
 This document serves to give tips and tricks on how to run Renovate locally to add features or fix bugs.
 Please submit PRs to improve it if you think anything is unclear or you can think of something that should be added.
 
-## General notes
-
-We are currently migrating to [typescript](https://www.typescriptlang.org), so please write all new files as `ts` files
-and feel free to help us to convert existing files.
-
-If you have to modify existing `js` files, please use modern [esm](https://nodejs.org/api/esm.html) `imports`
-and `exports`. We will transpile them to `commonjs` on build.
-
 ## Install
 
 #### Prerequisites
@@ -21,10 +13,10 @@ For local development some dependencies are required:
 - nodejs `^10.13.0 || ^12.0.0`
 - yarn `^1.17.0`
 - c++ compiler
-- python `^2.7` with `mock` library
+- python `^3.7`
 - java between `8` and `12`
 
-Python 2.7 is required in development in order to support installing with `node-gyp`, which does not yet support Python 3. `mock` is used by Renovate in production and is now part of the Python standard library, but only from 3.3 onwards.
+Python is required in development in order to support installing with `node-gyp`. `mock` is used by Renovate in production and is part of the Python standard library, but only from 3.3 onwards.
 
 Java is required to execute Gradle in tests.
 If you don’t have Java installed, the respective tests will be skipped.
@@ -34,7 +26,7 @@ _Linux_
 You can use the following commands for `Ubuntu`.
 
 ```sh
-curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
+curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
 curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
 echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
 sudo apt-get update
@@ -51,26 +43,21 @@ The following steps work to set up a brand new Windows 10 installation for devel
 - Install [Node.js LTS](https://nodejs.org/en/download/)
 - In an Administrator PowerShell prompt, run `npm install -global npm` and then `npm --add-python-to-path='true' --debug install --global windows-build-tools`
 - Install [Yarn](https://yarnpkg.com/lang/en/docs/install/#windows-stable)
-- Install `mock` for Python:
-  - `curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py`
-  - `python get-pip.py`
-  - `rm get-pip.py`
-  - `python -m pip install mock`
 - Install Java, e.g. from [AdoptOpenJDK](https://adoptopenjdk.net/?variant=openjdk11) or any other distribution
 
   Verify you have everything installed with appropriate versions, e.g.:
 
   ```
   PS C:\Windows\system32> git --version
-  git version 2.23.0.windows.1
+  git version 2.26.2.windows.1
   PS C:\Windows\system32> node --version
-  v10.16.3
+  v12.16.3
   PS C:\Windows\system32> yarn --version
-  1.19.0
+  1.22.4
   PS C:\Windows\system32> python --version
-  Python 2.7.16
-  PS C:\Windows\system32> python -c "import mock; print(mock.__version__)"
-  3.0.5
+  Python 3.8.1
+  PS C:\Windows\system32> python -c "from unittest import mock; print(mock.__version__)"
+  1.0
   PS C:\Windows\system32> java -version
   openjdk version "11.0.6" 2020-01-14
   OpenJDK Runtime Environment 18.9 (build 11.0.6+10)
diff --git a/requirements.txt b/requirements.txt
deleted file mode 100644
index 81ba9009bf..0000000000
--- a/requirements.txt
+++ /dev/null
@@ -1 +0,0 @@
-mock==3.0.5
-- 
GitLab