[Patches] [ python-Patches-407434 ] Meta-data XML output

nobody nobody@sourceforge.net
Fri, 09 Mar 2001 17:31:20 -0800


Patches #407434, was updated on 2001-03-09 17:31
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=407434&group_id=5470

Category: distutils
Group: None
Status: Open
Priority: 5
Submitted By: Amos Latteier
Assigned to: Nobody/Anonymous
Summary: Meta-data XML output

Initial Comment:
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



----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=407434&group_id=5470