This patch improves the DistributionMetadata class. It
adds the
ability to save and load meta-data to and from simple
XML files. This is needed since my experience shows
that it
is often impossible to extract meta-data from setup.py
files.
This patch will enable programs like the catalog to
read
distribution metadata without running setup.py.
It also beefs up the DistributionMetadata class so
that it now
functions like a dictionary, rather than an empty
class. This means
that getting data is more intuitive and meta-data
names no longer need
to be legal Python identifiers.
Finally the patch fixes the sdist and bdist_wininst
modules to work
correctly with the new DistributionMetadata class.
Note: IMHO, using
DistributionMetadata instances in now more pleasant.
The next step is to make meta-data be written to a
file (metadata.xml)
when a distribution is created. I wasn't sure where
the right place to
do this was, so I haven't included a patch for it. All
that is needed
though is something like the following:
m=distribution.metadata
f=open('metadata.xml', 'wb')
m.write_data(f)
f.close()
The distutils themselves won't have any need to read
meta-data files,
but other programs such as the catalog will. Those
programs can do the
following:
from distutils.dist import DistributionMetadata
m=DistributionMetadata()
f=open('metadata.xml', 'rb')
m.read_data(f)
f.close()
# At this point m is a dictionary mapping meta-data
names to values
|