Skip to content
Snippets Groups Projects
Commit c1f46ff4 authored by Rhys Arkins's avatar Rhys Arkins
Browse files

fix(pip_requirements): handle complex index-url

Closes #3944
parent deaa0281
No related branches found
Tags postgres-1.4.2
No related merge requests found
......@@ -22,7 +22,7 @@ function extractPackageFile(content) {
let registryUrls;
content.split('\n').forEach(line => {
if (line.startsWith('--index-url ')) {
const registryUrl = line.substring('--index-url '.length);
const registryUrl = line.substring('--index-url '.length).split(' ')[0];
registryUrls = [registryUrl];
}
});
......
......@@ -112,27 +112,32 @@ Array [
]
`;
exports[`lib/manager/pip_requirements/extract extractPackageFile() handles extras 1`] = `
Array [
Object {
"currentValue": "==2.0.12",
"datasource": "pypi",
"depName": "Django",
"fromVersion": "2.0.12",
"lineNumber": 0,
},
Object {
"currentValue": "==4.1.1",
"datasource": "pypi",
"depName": "celery",
"fromVersion": "4.1.1",
"lineNumber": 1,
},
Object {
"currentValue": " == 3.2.1",
"datasource": "pypi",
"depName": "foo",
"lineNumber": 2,
},
]
exports[`lib/manager/pip_requirements/extract extractPackageFile() handles extras and complex index url 1`] = `
Object {
"deps": Array [
Object {
"currentValue": "==2.0.12",
"datasource": "pypi",
"depName": "Django",
"fromVersion": "2.0.12",
"lineNumber": 1,
},
Object {
"currentValue": "==4.1.1",
"datasource": "pypi",
"depName": "celery",
"fromVersion": "4.1.1",
"lineNumber": 2,
},
Object {
"currentValue": " == 3.2.1",
"datasource": "pypi",
"depName": "foo",
"lineNumber": 3,
},
],
"registryUrls": Array [
"https://artifactory.company.com/artifactory/api/pypi/python/simple",
],
}
`;
......@@ -20,8 +20,9 @@ wsgiref==0.1.2 # something else
`;
exports[`manager/pip_requirements/update updateDependency replaces existing value with extras 1`] = `
"Django[argon2]==2.0.12
celery [redis]==4.1.2
"--index-url https://artifactory.company.com/artifactory/api/pypi/python/simple --trusted-host artifactory.company.com --default-timeout 600
Django[argon2]==4.1.2
celery [redis]==4.1.1
foo [bar] == 3.2.1 # handles extra white space
"
`;
--index-url https://artifactory.company.com/artifactory/api/pypi/python/simple --trusted-host artifactory.company.com --default-timeout 600
Django[argon2]==2.0.12
celery [redis]==4.1.1
foo [bar] == 3.2.1 # handles extra white space
......@@ -46,10 +46,13 @@ describe('lib/manager/pip_requirements/extract', () => {
expect(res).toMatchSnapshot();
expect(res).toHaveLength(5);
});
it('handles extras', () => {
const res = extractPackageFile(requirements4, config).deps;
it('handles extras and complex index url', () => {
const res = extractPackageFile(requirements4, config);
expect(res).toMatchSnapshot();
expect(res).toHaveLength(3);
expect(res.registryUrls).toEqual([
'https://artifactory.company.com/artifactory/api/pypi/python/simple',
]);
expect(res.deps).toHaveLength(3);
});
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment