# HG changeset patch # User Jeff Hammel # Date 1359353950 28800 # Node ID 00c0f668f3329b831d6d0930ffb8f7b9bc9ec90a # Parent b4fb27d126aa3cc05d5ffa2b3718a28b3b744bda implementation of setup2metadata diff -r b4fb27d126aa -r 00c0f668f332 paint/info.py --- a/paint/info.py Sun Jan 27 21:43:41 2013 -0800 +++ b/paint/info.py Sun Jan 27 22:19:10 2013 -0800 @@ -4,12 +4,12 @@ import imp +import pkginfo import os import subprocess import sys from distutils.dist import Distribution -from distutils.dist import DistributionMetadata from subprocess import check_call as call from StringIO import StringIO @@ -37,7 +37,17 @@ distribution = Distribution(attrs) buffer = StringIO() distribution.metadata.write_pkg_file(buffer) - raise NotImplementedError("TODO") + pkginfo_dist = pkginfo.Distribution() + pkinfo_dist.parse(buffer.getvalue()) + newattrs = dict((i, getattr(pkginfo_dist, i)) for i in pkginfo_dist) + header_dict = dict((attr_name, header_name) + for header_name, attr_name, multiple in pkginfo_dist._getHeaderAttrs()) + info = dict((header_dict[key], value) for key, value in newattrs.items()) + + # XXX pkginfo says 'Home-Page' though the spec says Home-page + info.setdefault('Home-page', info['Home-Page']) + + return info class PackageInfo(object):