File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed
plugins/package-managers/python/src/main/kotlin/utils Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ internal object PythonInspector : CommandLineTool {
111111 val packagePurls = mutableSetOf<String >()
112112 binaryResult.projects.forEach { project ->
113113 project.packageData.forEach { data ->
114- data.dependencies.mapTo (packagePurls) { it.purl }
114+ data.dependencies.mapNotNullTo (packagePurls) { it.purl }
115115 }
116116 }
117117
@@ -121,7 +121,7 @@ internal object PythonInspector : CommandLineTool {
121121 " (${binaryResult.packages.size} ), which might indicate a bug in python-inspector."
122122 }
123123
124- val resultsPurls = binaryResult.packages.mapTo (mutableSetOf ()) { it.purl }
124+ val resultsPurls = binaryResult.packages.mapNotNullTo (mutableSetOf ()) { it.purl }
125125 logger.warn { " Packages that are not contained as dependencies: ${packagePurls - resultsPurls} " }
126126 logger.warn { " Dependencies that are not contained as packages: ${resultsPurls - packagePurls} " }
127127 }
@@ -174,7 +174,7 @@ internal object PythonInspector : CommandLineTool {
174174
175175 @Serializable
176176 internal data class Dependency (
177- val purl : String ,
177+ val purl : String? ,
178178 val scope : String ,
179179 val isRuntime : Boolean ,
180180 val isOptional : Boolean ,
@@ -213,7 +213,7 @@ internal object PythonInspector : CommandLineTool {
213213 val repositoryHomepageUrl : String? ,
214214 val repositoryDownloadUrl : String? ,
215215 val apiDataUrl : String ,
216- val purl : String
216+ val purl : String?
217217 )
218218
219219 @Serializable
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ import org.ossreviewtoolkit.model.RemoteArtifact
3232import org.ossreviewtoolkit.model.Scope
3333import org.ossreviewtoolkit.model.VcsInfo
3434import org.ossreviewtoolkit.model.VcsType
35+ import org.ossreviewtoolkit.model.utils.toPurl
3536
3637private const val TYPE = " PyPI"
3738
@@ -142,7 +143,7 @@ internal fun List<PythonInspector.Package>.toOrtPackages(): Set<Package> =
142143 // The package has a namespace property which is currently always empty. Deliberately set the namespace to
143144 // an empty string here to be consistent with the resolved packages which do not have a namespace property.
144145 id = id,
145- purl = pkg.purl,
146+ purl = pkg.purl ? : id.toPurl() ,
146147 authors = pkg.parties.toAuthors(),
147148 declaredLicenses = declaredLicenses,
148149 declaredLicensesProcessed = declaredLicensesProcessed,
You can’t perform that action at this time.
0 commit comments