Skip to content

Commit

Permalink
Pip: Fix getting the binary and source artifacts
Browse files Browse the repository at this point in the history
The PyPI JSON API was changed to only include the URLs for the current
version on the version specific JSON pages [1].

[1]: pypi/warehouse#11775

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.io>
  • Loading branch information
mnonnenmacher committed Jul 8, 2022
1 parent c37961b commit 08df6b1
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions analyzer/src/main/kotlin/managers/Pip.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 08df6b1

Please sign in to comment.