classification
Title: Distutils (or py2exe) error with DistributionMetaData
Type: Stage:
Components: Distutils Versions: 3rd party
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: tarek Nosy List: loewis, tarek, varash
Priority: normal Keywords:

Created on 2009-04-21 14:30 by varash, last changed 2009-04-21 21:15 by loewis. This issue is now closed.

Messages (2)
msg86230 - (view) Author: Vah Rashim (varash) Date: 2009-04-21 14:30
I'find issue http://bugs.python.org/issue708320. It's closed, but in 
python 2.6 this problem are yet exists.

I'm fix it, but don't know, is this good solution. 
quote this my message from above issue without changes^
"""
I'm running py2exe on python 2.6 and have this error, too. I'm look 
through distutils/dist.py and read following:

self.metadata = DistributionMetadata()
method_basenames = dir(self.metadata) + \
                    ['fullname', 'contact', 'contact_email']

for basename in method_basenames:
    method_name = "get_" + basename
    setattr(self, method_name, getattr(self.metadata, method_name))

I'm printing dir(self.metadata) and get this lines:
['__doc__', '__init__', '__module__', 'author', 'author_email', 
'description', 'get_author', 'get_author_email', 'get_co
ntact', 'get_contact_email', 'get_description', 'get_fullname', 
'get_keywords', 'get_licence', 'get_long_description', '
get_maintainer', 'get_maintainer_email', 'get_name', 'get_platforms', 
'get_url', 'get_version', 'keywords', 'licence', '
long_description', 'maintainer', 'maintainer_email', 'name', 
'platforms', 'url', 'version', 'write_pkg_info']

code in dist.py trying add all methods from metadata to self, even 
'magic' and getters. I think, that's wrong, because no method like 
get___doc, get_get_contact and other.
I'm solve this problem by adding regexp for checking is this method 
allow for adding to self.

this is my (ugly, i think) code:
for basename in method_basenames:
    if re.match(r'(__|get_|write_)\w+', basename) is None: #MY FIXES!
        method_name = "get_" + basename
        setattr(self, method_name, getattr(self.metadata, method_name))

With this change, all py2exe works work correctly (and i don't try 
distutils in other cases).
P.S. i don't know, is this python or py2exe problem: maybe py2exe 
replcae nature python distutils module.
"""
msg86259 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2009-04-21 21:15
The bug report was closed here because it is not a bug in Python, but in
py2exe, which is independent of Python. Please report it to the py2exe
maintainers.

Closing this one as well.
History
Date User Action Args
2009-04-21 21:15:22loewissetstatus: open -> closed
versions: + 3rd party, - Python 2.6
nosy: + loewis

messages: + msg86259

resolution: not a bug
2009-04-21 14:30:38varashcreate