-
Notifications
You must be signed in to change notification settings - Fork 593
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
Add a setup.py
cataloger
#150
Conversation
Signed-off-by: Alfredo Deza <[email protected]>
// integrity check | ||
var _ common.ParserFn = parseSetup | ||
|
||
var pinnedDependency = regexp.MustCompile(`['"]\W?(\w+\W?==\W?[\w\.]*)`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: would be useful to add a few example matches in comments to illustrate to devs what this is trying to match on (similar to
syft/syft/cataloger/java/archive_filename.go
Lines 13 to 16 in ac9141e
// match examples: | |
// pkg-extra-field-4.3.2-rc1 --> match(name=pkg-extra-field version=4.3.2-rc1) | |
// pkg-extra-field-4.3-rc1 --> match(name=pkg-extra-field version=4.3-rc1) | |
// pkg-extra-field-4.3 --> match(name=pkg-extra-field version=4.3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great suggestion, I'll add those
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now improved!
// integrity check | ||
var _ common.ParserFn = parseSetup | ||
|
||
var pinnedDependency = regexp.MustCompile(`['"]\W?(\w+\W?==\W?[\w\.]*)`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: there is an opportunity to be more lenient with spaces and capture more environment marker cases with ['"]\s*([\w]+\s*==\s*[\w\.]*)\s*[;'"]
which would find ipaddress==1.0
in:
setup(
...
install_requires=[
'six',
'humanize',
],
extras_require={
':python_version == "2.7"': [
'ipaddress==1.0',
],
},
)
Not necessary to incorporate in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
solid addition
Signed-off-by: Alfredo Deza <[email protected]>
Signed-off-by: Alfredo Deza <[email protected]>
Add a `setup.py` cataloger
It will go into
setup.py
files, but only capture dependencies that are pinned (using the==
operator).Closes #59