Skip to content

Commit e01d408

Browse files
committed
fix(scancode): No ScanCode license texts in disclosure document
If ORT is executed within a Docker container, the report generator for the OSS disclosure document may not be able to look up the license texts collected by ScanCode, leading to empty sections in the disclosure document. In environments where Python version management tools like Pyenv are used, directory structures differ, leading to different paths for data directories, causing the reporter to fail looking up the ScanCode license texts. Update the heuristic algorithm to locate the ScanCode license texts directory based on the path of the ScanCode binary: Ensure compatibility with directory layouts managed by Python version management tools. Fixes oss-review-toolkit#8147. Signed-off-by: Wolfgang Klenk <[email protected]>
1 parent c259ffb commit e01d408

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

utils/spdx/src/main/kotlin/Utils.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ val scanCodeLicenseTextDir by lazy {
4949
val pythonBinDir = listOf("bin", "Scripts")
5050
val scanCodeBaseDir = scanCodeExeDir?.takeUnless { it.name in pythonBinDir } ?: scanCodeExeDir?.parentFile
5151

52-
scanCodeBaseDir?.walkTopDown()?.find { it.isDirectory && it.endsWith("licensedcode/data/licenses") }
52+
scanCodeBaseDir?.walkTopDown()?.find { it.isDirectory && it.endsWith("licensedcode/data/licenses") } ?:
53+
// In cases where Python version management tools like Pyenv are used, the directory structure differs.
54+
scanCodeBaseDir?.parentFile?.walkTopDown()?.find { it.isDirectory && it.endsWith("licensedcode/data/licenses") }
5355
}
5456

5557
/**

0 commit comments

Comments
 (0)