From 84ae2cd9437c68da4d150bdaa0180ad58972a9ad Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Thu, 28 Oct 2021 11:37:28 +0200 Subject: [PATCH] fix(pypi): do not compare returned name --- .../pypi/__snapshots__/index.spec.ts.snap | 15 --------------- lib/datasource/pypi/index.spec.ts | 18 ------------------ lib/datasource/pypi/index.ts | 17 ----------------- 3 files changed, 50 deletions(-) diff --git a/lib/datasource/pypi/__snapshots__/index.spec.ts.snap b/lib/datasource/pypi/__snapshots__/index.spec.ts.snap index a3bccdc7c1..85506ec22f 100644 --- a/lib/datasource/pypi/__snapshots__/index.spec.ts.snap +++ b/lib/datasource/pypi/__snapshots__/index.spec.ts.snap @@ -490,21 +490,6 @@ Array [ ] `; -exports[`datasource/pypi/index getReleases returns null if mismatched name 1`] = ` -Array [ - Object { - "headers": Object { - "accept": "application/json", - "accept-encoding": "gzip, deflate, br", - "host": "pypi.org", - "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", - }, - "method": "GET", - "url": "https://pypi.org/pypi/something/json", - }, -] -`; - exports[`datasource/pypi/index getReleases supports custom datasource url 1`] = ` Array [ Object { diff --git a/lib/datasource/pypi/index.spec.ts b/lib/datasource/pypi/index.spec.ts index 7cf65b23eb..c335b49217 100644 --- a/lib/datasource/pypi/index.spec.ts +++ b/lib/datasource/pypi/index.spec.ts @@ -172,24 +172,6 @@ describe('datasource/pypi/index', () => { expect(result.changelogUrl).toBe(info.project_urls.changelog); expect(httpMock.getTrace()).toMatchSnapshot(); }); - it('returns null if mismatched name', async () => { - httpMock - .scope(baseUrl) - .get('/something/json') - .reply(200, { - info: { - name: 'something-else', - home_page: 'https://microsoft.com', - }, - }); - expect( - await getPkgReleases({ - datasource, - depName: 'something', - }) - ).toBeNull(); - expect(httpMock.getTrace()).toMatchSnapshot(); - }); it('respects constraints', async () => { httpMock diff --git a/lib/datasource/pypi/index.ts b/lib/datasource/pypi/index.ts index 1adf3aa937..ba15c473f9 100644 --- a/lib/datasource/pypi/index.ts +++ b/lib/datasource/pypi/index.ts @@ -65,10 +65,6 @@ export class PypiDatasource extends Datasource { return dependency; } - private static normalizeName(input: string): string { - return input.toLowerCase().replace(regEx(/(-|\.)/g), '_'); - } - private async getDependency( packageName: string, hostUrl: string @@ -86,19 +82,6 @@ export class PypiDatasource extends Datasource { dependency.isPrivate = true; } logger.trace({ lookupUrl }, 'Got pypi api result'); - if ( - !( - dep.info && - PypiDatasource.normalizeName(dep.info.name) === - PypiDatasource.normalizeName(packageName) - ) - ) { - logger.warn( - { lookupUrl, lookupName: packageName, returnedName: dep.info.name }, - 'Returned name does not match with requested name' - ); - return null; - } if (dep.info?.home_page) { dependency.homepage = dep.info.home_page; -- GitLab