3232from commoncode import fileutils
3333from packagedcode .models import AssertedLicense
3434from packagedcode .models import PythonPackage
35+ from packagedcode import models
3536
3637
3738"""
@@ -76,7 +77,7 @@ def parse_pkg_info(location):
7677 asserted_licenses = [AssertedLicense (license = infos .get ('License' ))],
7778 # FIXME: what about Party objects and email?
7879 # FIXME: what about maintainers?
79- authors = [infos .get ('Author' )],
80+ authors = [models . Party ( type = models . party_person , name = infos .get ('Author' ) )],
8081 )
8182 return package
8283
@@ -122,15 +123,14 @@ def parse_metadata(location):
122123 """
123124 if not location or not location .endswith ('metadata.json' ):
124125 return
125-
126126 parent_dir = fileutils .parent_directory (location )
127127 # FIXME: is the absence of these two files a show stopper?
128128 if not all (os .path .exists (os .path .join (parent_dir , fname ))
129- for fname in ('METADATA' 'DESCRIPTION.rst' )):
129+ for fname in ('METADATA' , 'DESCRIPTION.rst' )):
130130 return
131131 # FIXME: wrap in a with statement
132132 infos = json .loads (open (location , 'rb' ).read ())
133-
133+ print ( infos )
134134 homepage_url = None
135135 authors = []
136136 if infos ['extensions' ]:
@@ -141,7 +141,7 @@ def parse_metadata(location):
141141 pass
142142 try :
143143 for contact in infos ['extensions' ]['python.details' ]['contacts' ]:
144- authors .append (contact ['name' ])
144+ authors .append (models . Party ( type = models . party_person , name = contact ['name' ],) )
145145 except :
146146 # FIXME: why catch all expections?
147147 pass
@@ -169,7 +169,7 @@ def parse(location):
169169 homepage_url = get_attribute (location , 'url' ),
170170 description = get_attribute (location , 'description' ),
171171 version = get_attribute (location , 'version' ),
172- authors = [get_attribute (location , 'author' )],
172+ authors = [models . Party ( type = models . party_person , name = get_attribute (location , 'author' ) )],
173173 asserted_licenses = [AssertedLicense (license = get_attribute (location , 'license' ))],
174174 )
175175 return package
0 commit comments