github.com/noqcks/syft@v0.0.0-20230920222752-a9e2c4e288e5/syft/pkg/cataloger/common/cpe/python.go (about) 1 package cpe 2 3 import ( 4 "fmt" 5 "strings" 6 7 "github.com/anchore/syft/syft/pkg" 8 ) 9 10 func additionalVendorsForPython(v string) (vendors []string) { 11 if !strings.HasSuffix(v, "project") { 12 vendors = append(vendors, fmt.Sprintf("%sproject", v), fmt.Sprintf("%s_project", v)) 13 } 14 15 return vendors 16 } 17 18 func candidateVendorsForPython(p pkg.Package) fieldCandidateSet { 19 metadata, ok := p.Metadata.(pkg.PythonPackageMetadata) 20 if !ok { 21 return nil 22 } 23 24 vendors := newFieldCandidateSet() 25 26 if metadata.Author != "" { 27 name := normalizePersonName(metadata.Author) 28 vendors.add(fieldCandidate{ 29 value: name, 30 disallowSubSelections: true, 31 disallowDelimiterVariations: true, 32 }) 33 34 for _, v := range additionalVendorsForPython(name) { 35 vendors.add(fieldCandidate{ 36 value: v, 37 disallowSubSelections: true, 38 disallowDelimiterVariations: true, 39 }) 40 } 41 } 42 43 if metadata.AuthorEmail != "" { 44 name := normalizePersonName(stripEmailSuffix(metadata.AuthorEmail)) 45 vendors.add(fieldCandidate{ 46 value: name, 47 disallowSubSelections: true, 48 }) 49 50 for _, v := range additionalVendorsForPython(name) { 51 vendors.add(fieldCandidate{ 52 value: v, 53 disallowSubSelections: true, 54 disallowDelimiterVariations: true, 55 }) 56 } 57 } 58 59 return vendors 60 }