oss-review-toolkit / ort

A suite of tools to automate software compliance checks.
https://oss-review-toolkit.org
Apache License 2.0
1.61k stars 309 forks source link

Running ORT on Windows tries to run scancode.bat, which might not exist #7745

Open cgz42 opened 1 year ago

cgz42 commented 1 year ago

When installing scancode-toolkit via pip (python -m install scancode-toolkit), no scancode.bat file is created. As a consequence the scancode invocation from ORT fails, as the usage of 'scancode.bat' is hard-coded on Windows.

Tested with:

When I add a scancode.bat next to the scancode executable, simply forwarding all the command line arguments, ORT scan with scancode works.

sschuberth commented 1 year ago

python -m install scancode-toolkit

I guess this should say "python -m pip install scancode-toolkit"? Anyway, I just tried, and it seems ScanCode is now using an .exe on Windows which is located e.g. at C:\Users\Sebastian\AppData\Roaming\Python\Python38\Scripts\scancode.exe.

Out of curiosity, @pombredanne do you recall when (in which version) ScanCode switched from .bat to .exe on Windows?

cgz42 commented 1 year ago

Yes, you are right. I forgot the install command in the pip command line.

The scancode.bat still exists in the scancode tarballs you can download from the scancode repository. It actually wraps the invocation of scancode.exe. When the batch file is called the first time, its runs configure.bat to create the scancode virtualenv and creates scancode.exe.

sschuberth commented 1 year ago

It actually wraps the invocation of scancode.exe.

So, would you agree that simply calling scancode.exe instead of scancode.bat from ORT should fix the issue?

cgz42 commented 1 year ago

This will break ORT for developers, who used the scancode tarball from the repo, because there is no scancode.exe. scancode.bat creates scancode.exe. On the other hand you can argue, that scancode-toolkit should have been configured once before calling ORT.

Safer options could be:

sschuberth commented 1 year ago

But: I am not sure, if this works the same way when called from kotlin.

Indeed that unfortunately doesn't work with Kotlin's / Java's ProcessBuilder, so I'll go for your first proposal.

malteharms commented 6 months ago

Are there plans to solve this bug in the near future? I would be interested in the result