[Patches] [ python-Patches-407434 ] Meta-data XML output
noreply@sourceforge.net
noreply@sourceforge.net
Tue, 20 Mar 2001 07:03:34 -0800
Patches item #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 (amosl)
Assigned to: A.M. Kuchling (akuchling)
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
----------------------------------------------------------------------
>Comment By: A.M. Kuchling (akuchling)
Date: 2001-03-20 07:03
Message:
Logged In: YES
user_id=11375
Here's a different patch, not really derived from Amos's,
that writes a PKG-INFO file when generating a source
distribution.
Still to resolve:
* Is there a finalize_options() on the Distribution class
where the keywords and platforms values can be converted
from strings to lists?
* Documentation.
----------------------------------------------------------------------
Comment By: A.M. Kuchling (akuchling)
Date: 2001-03-10 14:25
Message:
Logged In: YES
user_id=11375
That worked. The patch looks reasonable.
There's little point in checking it in
at this point, though, until we settle on the metadata
fields and decide the XML-vs-other-formats question.
----------------------------------------------------------------------
Comment By: Amos Latteier (amosl)
Date: 2001-03-10 13:58
Message:
Logged In: YES
user_id=157880
I am attempting to upload the patch again.
----------------------------------------------------------------------
Comment By: A.M. Kuchling (akuchling)
Date: 2001-03-10 11:51
Message:
Logged In: YES
user_id=11375
You seem to have run into the SourceForge file upload bug,
because there isn't a patch attached. You may want to try
again, or put it on the Web somewhere.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=407434&group_id=5470