mirror of
https://github.com/aquasecurity/trivy.git
synced 2026-12-05 02:02:53 +00:00
fix(python): skip dev group's deps for poetry (#8106)
Signed-off-by: nikpivkin <nikita.pivkin@smartforce.io>
This commit is contained in:
1 parent
7558df7c22
commit
a034d26443
11 files changed
+650
-50
No files matched your search
@@ -0,0 +1,14 @@
|
||||
package python
|
||||
|
||||
import "strings"
|
||||
|
||||
// NormalizePkgName normalizes the package name based on pep-0426
|
||||
func NormalizePkgName(name string) string {
|
||||
// The package names don't use `_`, `.` or upper case, but dependency names can contain them.
|
||||
// We need to normalize those names.
|
||||
// cf. https://peps.python.org/pep-0426/#name
|
||||
name = strings.ToLower(name) // e.g. https://github.com/python-poetry/poetry/blob/c8945eb110aeda611cc6721565d7ad0c657d453a/poetry.lock#L819
|
||||
name = strings.ReplaceAll(name, "_", "-") // e.g. https://github.com/python-poetry/poetry/blob/c8945eb110aeda611cc6721565d7ad0c657d453a/poetry.lock#L50
|
||||
name = strings.ReplaceAll(name, ".", "-") // e.g. https://github.com/python-poetry/poetry/blob/c8945eb110aeda611cc6721565d7ad0c657d453a/poetry.lock#L816
|
||||
return name
|
||||
}
|
||||
Reference in new issue
Block a user