From 08df6b187aa47dde3e7a6255f849c20193399fee Mon Sep 17 00:00:00 2001 From: Martin Nonnenmacher Date: Fri, 8 Jul 2022 11:13:50 +0200 Subject: [PATCH] Pip: Fix getting the binary and source artifacts The PyPI JSON API was changed to only include the URLs for the current version on the version specific JSON pages [1]. [1]: https://github.com/pypi/warehouse/pull/11775 Signed-off-by: Martin Nonnenmacher --- analyzer/src/main/kotlin/managers/Pip.kt | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/analyzer/src/main/kotlin/managers/Pip.kt b/analyzer/src/main/kotlin/managers/Pip.kt index 0ee90cd5acf0f..5691b5aa472cd 100644 --- a/analyzer/src/main/kotlin/managers/Pip.kt +++ b/analyzer/src/main/kotlin/managers/Pip.kt @@ -177,12 +177,6 @@ class Pip( "pypi.org", "pypi.python.org" // Legacy ).flatMap { listOf("--trusted-host", it) }.toTypedArray() - - /** - * Return a version string with leading zeros of components stripped. - */ - private fun stripLeadingZerosFromVersion(version: String) = - version.split('.').joinToString(".") { it.trimStart('0').ifEmpty { "0" } } } override fun command(workingDir: File?) = "pip" @@ -569,13 +563,7 @@ class Pip( val pkgInfo = pkgData["info"] - val pkgRelease = pkgData["releases"]?.let { pkgReleases -> - val pkgVersion = pkgReleases.fieldNames().asSequence().find { version -> - stripLeadingZerosFromVersion(version) == id.version - } - - pkgReleases[pkgVersion] - } as? ArrayNode + val pkgRelease = pkgData["urls"] as? ArrayNode val homepageUrl = pkgInfo["home_page"]?.textValue().orEmpty() val declaredLicenses = getDeclaredLicenses(pkgInfo)