diff --git a/data/extract.py b/data/extract.py index fcd98b2aeab428c17514dab71d676599d9120aa6..15cdd344210204e149050a106da14e4e2f22dbbd 100644 --- a/data/extract.py +++ b/data/extract.py @@ -1,7 +1,6 @@ import sys import json import os -import distutils.core from os.path import basename if sys.version_info[:2] >= (3, 3): @@ -24,6 +23,8 @@ except ImportError: def setup(): pass +import distutils.core + try: from unittest import mock except ImportError: diff --git a/lib/manager/pip_setup/__snapshots__/index.spec.ts.snap b/lib/manager/pip_setup/__snapshots__/index.spec.ts.snap index b6ddf4d852c4e8c03174e9c5f58126daaea985c2..90739759f1148c1809ce0b194d4901582fa5c4cc 100644 --- a/lib/manager/pip_setup/__snapshots__/index.spec.ts.snap +++ b/lib/manager/pip_setup/__snapshots__/index.spec.ts.snap @@ -56,6 +56,24 @@ Array [ "timeout": 900000, }, }, + Object { + "cmd": "python3.9 --version", + "options": Object { + "cwd": "/tmp/github/some/repo", + "encoding": "utf-8", + "env": Object { + "HOME": "/home/user", + "HTTPS_PROXY": "https://example.com", + "HTTP_PROXY": "http://example.com", + "LANG": "en_US.UTF-8", + "LC_ALL": "en_US", + "NO_PROXY": "localhost", + "PATH": "/tmp/path", + }, + "maxBuffer": 10485760, + "timeout": 900000, + }, + }, Object { "cmd": "<extract.py> \\"folders/foobar.py\\"", "options": Object { @@ -371,24 +389,6 @@ Array [ "timeout": 900000, }, }, - Object { - "cmd": "python3.8 --version", - "options": Object { - "cwd": "/tmp/github/some/repo", - "encoding": "utf-8", - "env": Object { - "HOME": "/home/user", - "HTTPS_PROXY": "https://example.com", - "HTTP_PROXY": "http://example.com", - "LANG": "en_US.UTF-8", - "LC_ALL": "en_US", - "NO_PROXY": "localhost", - "PATH": "/tmp/path", - }, - "maxBuffer": 10485760, - "timeout": 900000, - }, - }, Object { "cmd": "<extract.py> \\"lib/manager/pip_setup/__fixtures__/setup.py\\"", "options": Object { @@ -448,24 +448,6 @@ Array [ "timeout": 900000, }, }, - Object { - "cmd": "python3.8 --version", - "options": Object { - "cwd": "/tmp/github/some/repo", - "encoding": "utf-8", - "env": Object { - "HOME": "/home/user", - "HTTPS_PROXY": "https://example.com", - "HTTP_PROXY": "http://example.com", - "LANG": "en_US.UTF-8", - "LC_ALL": "en_US", - "NO_PROXY": "localhost", - "PATH": "/tmp/path", - }, - "maxBuffer": 10485760, - "timeout": 900000, - }, - }, Object { "cmd": "<extract.py> \\"lib/manager/pip_setup/__fixtures__/setup.py\\"", "options": Object { @@ -525,24 +507,6 @@ Array [ "timeout": 900000, }, }, - Object { - "cmd": "python3.8 --version", - "options": Object { - "cwd": "/tmp/github/some/repo", - "encoding": "utf-8", - "env": Object { - "HOME": "/home/user", - "HTTPS_PROXY": "https://example.com", - "HTTP_PROXY": "http://example.com", - "LANG": "en_US.UTF-8", - "LC_ALL": "en_US", - "NO_PROXY": "localhost", - "PATH": "/tmp/path", - }, - "maxBuffer": 10485760, - "timeout": 900000, - }, - }, Object { "cmd": "<extract.py> \\"folders/foobar.py\\"", "options": Object { diff --git a/lib/manager/pip_setup/extract.spec.ts b/lib/manager/pip_setup/extract.spec.ts index d2fff37884be74e519ed5c041dc08354b678e9b4..daee26c623f7a749b0f6a7b2b11513a9ec9109c1 100644 --- a/lib/manager/pip_setup/extract.spec.ts +++ b/lib/manager/pip_setup/extract.spec.ts @@ -29,6 +29,7 @@ describe(getName(__filename), () => { { stdout: '', stderr: 'Python 2.7.17\\n' }, new Error(), { stdout: 'Python 3.8.0\\n', stderr: '' }, + new Error(), ]); const result = await getPythonAlias(); expect(pythonVersions).toContain(result); diff --git a/lib/manager/pip_setup/extract.ts b/lib/manager/pip_setup/extract.ts index 7fccd05ade7226623c63e89f9b3c1791f17517fe..79f93a902b851857cbddaeede51a5c29cb4a7e72 100644 --- a/lib/manager/pip_setup/extract.ts +++ b/lib/manager/pip_setup/extract.ts @@ -8,7 +8,7 @@ import { ExtractConfig, PackageDependency, PackageFile } from '../common'; import { dependencyPattern } from '../pip_requirements/extract'; import { PythonSetup, getExtractFile, parseReport } from './util'; -export const pythonVersions = ['python', 'python3', 'python3.8']; +export const pythonVersions = ['python', 'python3', 'python3.8', 'python3.9']; let pythonAlias: string | null = null; export function resetModule(): void { @@ -31,6 +31,7 @@ export async function getPythonAlias(): Promise<string> { const version = parsePythonVersion(stdout || stderr); if (version[0] >= 3 && version[1] >= 7) { pythonAlias = pythonVersion; + break; } } catch (err) { logger.debug(`${pythonVersion} alias not found`); diff --git a/lib/manager/pip_setup/index.spec.ts b/lib/manager/pip_setup/index.spec.ts index 09d58f3d5a7d9bd9ff038fd5ec83635d3d52dfd5..b5cd418f0c9c8190de837761e2ce20864a0c4548 100644 --- a/lib/manager/pip_setup/index.spec.ts +++ b/lib/manager/pip_setup/index.spec.ts @@ -30,7 +30,6 @@ jest.mock('../../util/exec/env'); const pythonVersionCallResults = [ { stdout: '', stderr: 'Python 2.7.17\\n' }, { stdout: 'Python 3.7.5\\n', stderr: '' }, - new Error(), ]; // TODO: figure out snapshot similarity for each CI platform @@ -67,7 +66,7 @@ describe(getName(__filename), () => { expect( await extractPackageFile(content, packageFile, config) ).toMatchSnapshot(); - expect(exec).toHaveBeenCalledTimes(4); + expect(exec).toHaveBeenCalledTimes(3); expect(fixSnapshots(execSnapshots)).toMatchSnapshot(); }); @@ -96,7 +95,7 @@ describe(getName(__filename), () => { ]); jest.spyOn(fs, 'readLocalFile').mockResolvedValueOnce('{}'); expect(await extractPackageFile(content, packageFile, config)).toBeNull(); - expect(exec).toHaveBeenCalledTimes(4); + expect(exec).toHaveBeenCalledTimes(3); expect(fixSnapshots(execSnapshots)).toMatchSnapshot(); }); @@ -112,7 +111,7 @@ describe(getName(__filename), () => { config ) ).toBeNull(); - expect(exec).toHaveBeenCalledTimes(4); + expect(exec).toHaveBeenCalledTimes(3); expect(fixSnapshots(execSnapshots)).toMatchSnapshot(); }); it('catches error', async () => {