-
-
Notifications
You must be signed in to change notification settings - Fork 576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scancode fails to inventory package manifest files #2408
Comments
@bmarsh9 hey! thanks for the report! Hence The point is that we need to get some trigger to decide to look in a file especially since the syntax of a requirements file is pretty lax, so there is no obvious content-based way to detect that a text file is a really a requirements file. FYI, note that there are a few pending/in progress tickets related to Python packages in general:
|
Thanks for the quick response. That makes sense.. I figured it was doing some pattern matching. Is there a flag for specifying which packages to look for or a pattern? So for example if I wanted to tell scancode to treat If not, that would be a nice feature to have Thanks! |
However Im still seeing some issues when a run a scan against a directory. Verify requirements.txt exists and run scan
Output with no dependency results
|
Looking at that code snippet you posted.. it should work.
And the code is basically
|
More testing Scanning directory with requirements.txt
Scanning file in same directory
|
Looks like its throwing this error:
If I include Error is thrown here: https://github.com/nexB/scancode-toolkit/blob/f3ef5b4ad823577e507d673a7fbc65d5efe4f6af/src/packagedcode/recognize.py#L44 |
I do not like adding too many command line flags... here the issue would be if there is a need for a flag to look for any package type? (one flag per type would be worse). The rationale is that at some level each additional way to configure things is a sign at some level that we are getting it done right in the first place. On the other hand adding extra patterns such as dev.txt, prod.txt solo or inside a /requirements/ dir would made sense. |
Can you attach your requirements file? In https://github.com/nexB/scancode-toolkit/blob/5174a3b21758d0d6d5c1db3c74494d56e49a8e74/src/scancode/api.py#L299 we mute the exceptions thrown from failing to parse a package manifest as there was too much noise from that. |
Here is the file (renamed to With the debug flag
It says FileNotFound but I have tried the absolute and relative path in the variable
|
But it will work if I move the |
@bmarsh9 are you sure that your path is correct?
Also in all cases, we should detect .txt files in a requirements dir alright: That's a bug we need to fix. |
@pombredanne Yep, path exists
|
So this should work. Does it (assuming you have wget)?:
|
Yep that works. But if the returns the error with absolute or relative path
So I guess |
so this is a clear bug! Thank you for your patience. |
Course. Let me know if you need any re-testing. Thanks! |
@bmarsh9 we have now a brand new requirements.txt parser derived from pip that landed in the develop branch
We are also revamping the dependencies handling across the board. |
Description
Hey there,
Scancode appears to only scan package manifest files based on the name AND if the scan is run in the same directory. For example, if my python manifest file is named
dev.txt
, scancode does not appear to inventory it. However, if I rename the file torequirements.txt
AND run scancode from the same directory, scancode will inventory it and the package dependencies will populate in the json output.. as shown below. There's also a possibility I am using it wrong and this is expected.How To Reproduce
Here we run scancode against the entire directory (no package dependencies shown)
Command:
scancode -clpeui --json-pp out.json flask-sqlalchemy
Now we run scancode in the same directory against the file and we get package dependencies
Command:
scancode -clpeui --json-pp out.json requirements.txt
scancode -clpeui --json-pp out.json flask-sqlalchemy
scancode -clpeui --json-pp out.json requirements.txt
System configuration
Python 3.6.13
FROM python:3.6-slim-buster
is the base docker imageVersion: ScanCode version 21.2.9
The text was updated successfully, but these errors were encountered: