mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-10 05:56:26 +00:00
Merge 174eb59d44
into b7f96b2ea1
This commit is contained in:
commit
3a88bfd03c
3 changed files with 40 additions and 7 deletions
|
@ -0,0 +1,10 @@
|
|||
# Repositories
|
||||
--index-url=https://artifactory.company.com/artifactory/api/pypi/python/simple --trusted-host artifactory.company.com --default-timeout 600
|
||||
--extra-index-url=http://example.com/private-pypi/
|
||||
# Packages
|
||||
Django[argon2]==2.0.12
|
||||
celery [redis]==4.1.1
|
||||
foo [bar] == 3.2.1 # handles extra white space
|
||||
some-package==0.3.1
|
||||
some-other-package==1.0.0
|
||||
not_semver==1.9
|
|
@ -33,13 +33,23 @@ export function extractPackageFileFlags(
|
|||
const additionalRequirementsFiles: string[] = [];
|
||||
const additionalConstraintsFiles: string[] = [];
|
||||
content.split(newlineRegex).forEach((line) => {
|
||||
if (line.startsWith('-i ') || line.startsWith('--index-url ')) {
|
||||
registryUrls = [line.split(' ')[1]];
|
||||
} else if (line.startsWith('--extra-index-url ')) {
|
||||
const extraUrl = line
|
||||
.substring('--extra-index-url '.length)
|
||||
.split(' ')[0];
|
||||
additionalRegistryUrls.push(extraUrl);
|
||||
if (line.startsWith('-i ') || line.startsWith('--index-url')) {
|
||||
// parameters can be separated by space or =, same below for --extra-index-url
|
||||
if (line.includes('=')) {
|
||||
registryUrls = [line.split('=')[1]];
|
||||
} else {
|
||||
registryUrls = [line.split(' ')[1]];
|
||||
}
|
||||
} else if (line.startsWith('--extra-index-url')) {
|
||||
if (line.includes('=')) {
|
||||
const extraUrl = line.split('=')[1];
|
||||
additionalRegistryUrls.push(extraUrl);
|
||||
} else {
|
||||
const extraUrl = line
|
||||
.substring('--extra-index-url '.length)
|
||||
.split(' ')[0];
|
||||
additionalRegistryUrls.push(extraUrl);
|
||||
}
|
||||
} else if (line.startsWith('-r ')) {
|
||||
additionalRequirementsFiles.push(line.split(' ')[1]);
|
||||
} else if (line.startsWith('-c ')) {
|
||||
|
|
|
@ -10,6 +10,7 @@ const requirements5 = Fixtures.get('requirements5.txt');
|
|||
const requirements6 = Fixtures.get('requirements6.txt');
|
||||
const requirements7 = Fixtures.get('requirements7.txt');
|
||||
const requirements8 = Fixtures.get('requirements8.txt');
|
||||
const requirements9 = Fixtures.get('requirements9.txt');
|
||||
const requirementsWithEnvMarkers = Fixtures.get('requirements-env-markers.txt');
|
||||
const requirementsGitPackages = Fixtures.get('requirements-git-packages.txt');
|
||||
|
||||
|
@ -120,6 +121,18 @@ some-package==0.3.1`;
|
|||
expect(res?.deps).toHaveLength(6);
|
||||
});
|
||||
|
||||
it('handles index urls with = as separator', () => {
|
||||
const res = extractPackageFile(requirements9);
|
||||
expect(res).toMatchSnapshot();
|
||||
expect(res?.registryUrls).toEqual([
|
||||
'https://artifactory.company.com/artifactory/api/pypi/python/simple',
|
||||
]);
|
||||
expect(res?.additionalRegistryUrls).toEqual([
|
||||
'http://example.com/private-pypi/',
|
||||
]);
|
||||
expect(res?.deps).toHaveLength(6);
|
||||
});
|
||||
|
||||
it('handles extra index url and defaults without index to config', () => {
|
||||
const res = extractPackageFile(requirements6);
|
||||
expect(res).toMatchSnapshot();
|
||||
|
|
Loading…
Reference in a new issue