private static void collectWheelMetadata ( Dependency dependency , File file ) { final InternetHeaders headers = getManifestProperties ( file ) ; addPropertyToEvidence ( dependency , EvidenceType . VERSION , Confidence . HIGHEST , headers , "Version" ) ; addPropertyToEvidence ( dependency , EvidenceType . PRODUCT , Confidence . HIGHEST , headers , "Name" ) ; addPropertyToEvidence ( dependency , EvidenceType . PRODUCT , Confidence . MEDIUM , headers , "Name" ) ; final String name = headers . getHeader ( "Name" , null ) ; final String version = headers . getHeader ( "Version" , null ) ; final String packagePath = String . format ( "%s:%s" , name , version ) ; dependency . setName ( name ) ; dependency . setVersion ( version ) ; dependency . setPackagePath ( packagePath ) ; dependency . setDisplayFileName ( packagePath ) ; final String url = headers . getHeader ( "Home-page" , null ) ; if ( StringUtils . isNotBlank ( url ) ) { if ( UrlStringUtils . isUrl ( url ) ) { dependency . addEvidence ( EvidenceType . VENDOR , METADATA , "vendor" , url , Confidence . MEDIUM ) ; } } addPropertyToEvidence ( dependency , EvidenceType . VENDOR , Confidence . LOW , headers , "Author" ) ; final String summary = headers . getHeader ( "Summary" , null ) ; if ( StringUtils . isNotBlank ( summary ) ) { JarAnalyzer . addDescription ( dependency , summary , METADATA , "summary" ) ; } try { final PackageURL purl = PackageURLBuilder . aPackageURL ( ) . withType ( "pypi" ) . withName ( name ) . withVersion ( version ) . build ( ) ; dependency . addSoftwareIdentifier ( new PurlIdentifier ( purl , Confidence . HIGHEST ) ) ; } catch ( MalformedPackageURLException ex ) { LOGGER . debug ( "Unable to build package url for python" , ex ) ; final GenericIdentifier id = new GenericIdentifier ( "generic:" + name + "@" + version , Confidence . HIGHEST ) ; dependency . addSoftwareIdentifier ( id ) ; } }
Gathers evidence from the METADATA file .