[Pythonmac-SIG] Python Metadata Importer

Bob Ippolito bob at redivi.com
Thu May 26 19:52:05 CEST 2005


On May 26, 2005, at 8:05 AM, Nicholas Riley wrote:

> On Thu, May 26, 2005 at 10:54:59AM -0400, Jonathan Wight wrote:
>
>> After adding Gideon's suggestion for CRLF ending file. My importer is
>> failing on only 8 files out of 3084 files.
>>
>> All the failures are with Python files that try to generate the
>> __version__ attribute with code instead, e.g.:
>>
>> __version__ = string.split('$Revision: 1.8 $')[1]
>> __version__ = '$Revision: 1.6 $'[11:-2]
>>
>> And so on.
>>
>> My options are:
>>
>> #1 Continue to fail and not process the script any further (easiest
>> solution ;-)
>> #2 Just ignore the attribute in question.
>> #3 Convert the attribute into a string even though it might not make
>> much sense.
>> #4 Execute the line and get the computed value of the attribute.
>>
>> I don't really want to execute the line - who the heck knows what it
>> could do. Unless anyone has any better ideas I'm just going to try
>> and gracefully ignore the attribute.
>>
>
> How about just recognizing versions that have the form "$Revision:
> foo$" and stripping the tag info, just as the code above does?

There are still other places where you'll have version expressions.

PyOpenGL's is the most braindead, it reads the version from *A FILE*.

Many extensions bring in the version from some extension (i.e. PyObjC).

I'd go ahead and just ignore anything that isn't a string. 99.74% of  
modules isn't bad.

Not many people do the CVS thing these days, and that number is going  
to get smaller and smaller since people are replacing CVS with  
Subversion and others.

-bob



More information about the Pythonmac-SIG mailing list