Commits

Ronny Pfannschmidt committed a29b975

extend metadata extraction a bit

  • Participants
  • Parent commits 03dec26

Comments (0)

Files changed (2)

genscript/utils.py

 
     if name and mail:
         return '%s <%s>' % (name, mail)
-    elif name:
-        return name
-    else:
-        return mail
+    return name or mail
 
-
-def distribution_metadata(dist):
-    metadata = dist.metadata
-    author = grab_person(metadata, 'author')
-    version = metadata.version
+def distribution_metadata(meta):
     return {
-        'author': author,
-        'version': version,
-        'url': grab_attr(metadata, 'url'),
+        'author': grab_person(meta, 'author'),
+        'maintainer': grab_person(meta, 'maintainer'),
+        'version': meta.version,
+        'url': grab_attr(meta, 'url'),
     }
 

testing/test_utils.py

     }
 
     dist = dist_class(input)
-    extracted = distribution_metadata(dist)
+    extracted = distribution_metadata(dist.metadata)
     assert extracted == {
         'version': '1.0',
         'author': 'Test <test@example.com>',
         'url': None,
+        'maintainer': None,
     }