mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 08:23:15 +01:00
bump JSON schema to account for simplified python env markers (#1967)
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
parent
9480f10ccd
commit
d84120f499
@ -6,5 +6,5 @@ const (
|
||||
|
||||
// JSONSchemaVersion is the current schema version output by the JSON encoder
|
||||
// This is roughly following the "SchemaVer" guidelines for versioning the JSON schema. Please see schema/json/README.md for details on how to increment.
|
||||
JSONSchemaVersion = "9.0.2"
|
||||
JSONSchemaVersion = "10.0.0"
|
||||
)
|
||||
|
||||
1926
schema/json/schema-10.0.0.json
Normal file
1926
schema/json/schema-10.0.0.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -156,25 +156,12 @@ func parseExtras(packageName string) []string {
|
||||
return []string{}
|
||||
}
|
||||
|
||||
func parseMarkers(line string) map[string]string {
|
||||
markers := map[string]string{}
|
||||
func parseMarkers(line string) string {
|
||||
var markers string
|
||||
parts := strings.SplitN(line, ";", 2)
|
||||
|
||||
if len(parts) == 2 {
|
||||
splittableMarkers := parts[1]
|
||||
|
||||
for _, combineString := range []string{" or ", " and "} {
|
||||
splittableMarkers = strings.TrimSpace(
|
||||
strings.ReplaceAll(splittableMarkers, combineString, ","),
|
||||
)
|
||||
}
|
||||
|
||||
splittableMarkers = strings.TrimSpace(splittableMarkers)
|
||||
|
||||
for _, mark := range strings.Split(splittableMarkers, ",") {
|
||||
markparts := strings.Split(mark, " ")
|
||||
markers[markparts[0]] = strings.Join(markparts[1:], " ")
|
||||
}
|
||||
markers = strings.TrimSpace(parts[1])
|
||||
}
|
||||
|
||||
return markers
|
||||
|
||||
@ -26,7 +26,6 @@ func TestParseRequirementsTxt(t *testing.T) {
|
||||
Extras: []string{},
|
||||
VersionConstraint: "== 4.0.0",
|
||||
URL: "",
|
||||
Markers: map[string]string{},
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -42,7 +41,6 @@ func TestParseRequirementsTxt(t *testing.T) {
|
||||
Extras: []string{},
|
||||
VersionConstraint: "== 1.0.0",
|
||||
URL: "",
|
||||
Markers: map[string]string{},
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -58,7 +56,7 @@ func TestParseRequirementsTxt(t *testing.T) {
|
||||
Extras: []string{},
|
||||
VersionConstraint: "== 5.4",
|
||||
URL: "",
|
||||
Markers: map[string]string{"python_version": "< '3.8'"},
|
||||
Markers: "python_version < '3.8'",
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -74,7 +72,6 @@ func TestParseRequirementsTxt(t *testing.T) {
|
||||
Extras: []string{},
|
||||
VersionConstraint: "== 0.26.2",
|
||||
URL: "",
|
||||
Markers: map[string]string{},
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -90,7 +87,6 @@ func TestParseRequirementsTxt(t *testing.T) {
|
||||
Extras: []string{},
|
||||
VersionConstraint: "== 0.26.3",
|
||||
URL: "",
|
||||
Markers: map[string]string{},
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -106,7 +102,6 @@ func TestParseRequirementsTxt(t *testing.T) {
|
||||
Extras: []string{"redis", "pytest"},
|
||||
VersionConstraint: "== 4.4.7",
|
||||
URL: "",
|
||||
Markers: map[string]string{},
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -122,10 +117,7 @@ func TestParseRequirementsTxt(t *testing.T) {
|
||||
Extras: []string{"security"},
|
||||
VersionConstraint: "== 2.8",
|
||||
URL: "",
|
||||
Markers: map[string]string{
|
||||
"python_version": `< "2.7"`,
|
||||
"sys_platform": `== "linux"`,
|
||||
},
|
||||
Markers: `python_version < "2.7" and sys_platform == "linux"`,
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -141,7 +133,6 @@ func TestParseRequirementsTxt(t *testing.T) {
|
||||
Extras: []string{},
|
||||
VersionConstraint: "== 3.7.1",
|
||||
URL: "git+https://github.com/owner/repo@releases/tag/v3.7.1",
|
||||
Markers: map[string]string{},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
package pkg
|
||||
|
||||
type PythonRequirementsMetadata struct {
|
||||
Name string `json:"name" mapstruct:"Name"`
|
||||
Extras []string `json:"extras" mapstruct:"Extras"`
|
||||
VersionConstraint string `json:"versionConstraint" mapstruct:"VersionConstraint"`
|
||||
URL string `json:"url" mapstruct:"URL"`
|
||||
Markers map[string]string `json:"markers" mapstruct:"Markers"`
|
||||
Name string `json:"name" mapstruct:"Name"`
|
||||
Extras []string `json:"extras" mapstruct:"Extras"`
|
||||
VersionConstraint string `json:"versionConstraint" mapstruct:"VersionConstraint"`
|
||||
URL string `json:"url" mapstruct:"URL"`
|
||||
Markers string `json:"markers" mapstruct:"Markers"`
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user