[Distutils] [PATCH] Write distribution meta-data an XML file

Amos Latteier amos@digicool.com
Fri Mar 9 21:08:01 2001


Hi Guys,

I've added a patch on sourceforge to allow distribution
meta-data to be written to an XML file. This should help the
catalog effort.

  http://sourceforge.net/tracker/index.phpfunc=detail&aid=407434&group_id=5470&atid=305470

The reason for the patch is that I've found out that it's
hard to extract distribution meta-data by running setup.py.
Often setup.py will not run if you don't have the required
environment. Also, there is an inherent security problem in
running setup.py to extra meta-data if you don't trust the
distribution.

By writing meta-data to a file programs like the catalog can
find out the meta-data of a distribution without running any
distribution code. In fact all they'll have to do is this:

  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 

-Amos

P.S. I am not attached to any paticular format for the
meta-data file. I chose XML since it seemed reasonable and
easy. I also considered RFC822. In any event, if we decide
that another format is better, all that is needed is to
change the 'write_data' and 'read_data' methods on the
DistributionMetadata class.