mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-10 21:07:48 +00:00
[python] Add warning for deprecated version (#7053)
- Print warning when python 3.6 is selected - Print warning when invalid python version is selected
This commit is contained in:
@@ -114,10 +114,24 @@ export const build = async ({
|
||||
try {
|
||||
const json = await readFile(join(pipfileLockDir, 'Pipfile.lock'), 'utf8');
|
||||
const obj = JSON.parse(json);
|
||||
if (!meta.isDev && obj?._meta?.requires?.python_version === '3.6') {
|
||||
pipPath = 'pip3.6';
|
||||
pythonPath = 'python3.6';
|
||||
pythonRuntime = 'python3.6';
|
||||
const version = obj?._meta?.requires?.python_version;
|
||||
if (!meta.isDev) {
|
||||
if (version === '3.6') {
|
||||
pipPath = 'pip3.6';
|
||||
pythonPath = 'python3.6';
|
||||
pythonRuntime = 'python3.6';
|
||||
console.warn(
|
||||
`Warning: Python version "${version}" detected in Pipfile.lock will reach End-Of-Life December 2021. Please upgrade. http://vercel.link/python-version`
|
||||
);
|
||||
} else if (version === '3.9') {
|
||||
pipPath = 'pip3.9';
|
||||
pythonPath = 'python3.9';
|
||||
pythonRuntime = 'python3.9';
|
||||
} else {
|
||||
console.warn(
|
||||
`Warning: Invalid Python version "${version}" detected in Pipfile.lock will be ignored. http://vercel.link/python-version`
|
||||
);
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
throw new NowBuildError({
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [{ "src": "index.py", "use": "@vercel/python" }],
|
||||
"probes": [{ "path": "/", "mustContain": "wsgi:RANDOMNESS_PLACEHOLDER" }]
|
||||
}
|
||||
11
packages/python/test/fixtures/02-wsgi-pipenv/vercel.json
vendored
Normal file
11
packages/python/test/fixtures/02-wsgi-pipenv/vercel.json
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [{ "src": "index.py", "use": "@vercel/python" }],
|
||||
"probes": [
|
||||
{
|
||||
"path": "/",
|
||||
"mustContain": "wsgi:RANDOMNESS_PLACEHOLDER",
|
||||
"logMustContain": "Warning: Python version \"3.6\" detected in Pipfile.lock will reach End-Of-Life December 2021. Please upgrade."
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [{ "src": "index.py", "use": "@vercel/python" }],
|
||||
"env": {
|
||||
"RANDOMNESS": "RANDOMNESS_PLACEHOLDER"
|
||||
},
|
||||
"probes": [{ "path": "/", "mustContain": "RANDOMNESS_PLACEHOLDER:env" }]
|
||||
}
|
||||
14
packages/python/test/fixtures/03-env-vars/vercel.json
vendored
Normal file
14
packages/python/test/fixtures/03-env-vars/vercel.json
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [{ "src": "index.py", "use": "@vercel/python" }],
|
||||
"env": {
|
||||
"RANDOMNESS": "RANDOMNESS_PLACEHOLDER"
|
||||
},
|
||||
"probes": [
|
||||
{
|
||||
"path": "/",
|
||||
"mustContain": "RANDOMNESS_PLACEHOLDER:env",
|
||||
"logMustContain": "Warning: Python version \"3.6\" detected in Pipfile.lock will reach End-Of-Life December 2021. Please upgrade."
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [{ "src": "**/**.py", "use": "@vercel/python" }],
|
||||
"probes": [{ "path": "/", "mustContain": "pip:RANDOMNESS_PLACEHOLDER" }]
|
||||
}
|
||||
11
packages/python/test/fixtures/04-cowsay-pipfile/vercel.json
vendored
Normal file
11
packages/python/test/fixtures/04-cowsay-pipfile/vercel.json
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [{ "src": "**/**.py", "use": "@vercel/python" }],
|
||||
"probes": [
|
||||
{
|
||||
"path": "/",
|
||||
"mustContain": "pip:RANDOMNESS_PLACEHOLDER",
|
||||
"logMustContain": "Warning: Invalid Python version \"3.7\" detected in Pipfile.lock will be ignored."
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user