diff --git a/utils/spdx/src/main/kotlin/Utils.kt b/utils/spdx/src/main/kotlin/Utils.kt index 876f8ecf257f9..6891411b6c34a 100644 --- a/utils/spdx/src/main/kotlin/Utils.kt +++ b/utils/spdx/src/main/kotlin/Utils.kt @@ -49,7 +49,9 @@ val scanCodeLicenseTextDir by lazy { val pythonBinDir = listOf("bin", "Scripts") val scanCodeBaseDir = scanCodeExeDir?.takeUnless { it.name in pythonBinDir } ?: scanCodeExeDir?.parentFile - scanCodeBaseDir?.walkTopDown()?.find { it.isDirectory && it.endsWith("licensedcode/data/licenses") } + scanCodeBaseDir?.walkTopDown()?.find { it.isDirectory && it.endsWith("licensedcode/data/licenses") } ?: + // In cases where Python version management tools like Pyenv are used, the directory structure differs. + scanCodeBaseDir?.parentFile?.walkTopDown()?.find { it.isDirectory && it.endsWith("licensedcode/data/licenses") } } /**