[Python-3000] distutils: usage of the 'map()' builtin breaks the parsing of MANIFEST.in

Lisandro Dalcin dalcinl at gmail.com
Thu Jul 24 21:03:01 CEST 2008

In module 'distutils.filelist', class 'FileList', method
'_parse_template_line()', the 'map()' builtin is being used. Now
'map()' returns an iterator, and this iterator is exhausted in other
methods (for the purpose of 'debug_print()' stuff) before the data is
actually used.

I'm currently monkey-patching like this, but a patch for 'distutils'
perhaps should be implemented in terms of list comprehensions,
removing the usage of 'map()' builtin.

from distutils import filelist

_FileList = filelist.FileList

class FileList(_FileList):

    def _parse_template_line(self, line):
        (action, patterns, dir, dir_pattern) = \
                 _FileList._parse_template_line(self, line)
        if patterns is not None:
            patterns = list(patterns)
        return (action, patterns, dir, dir_pattern)

filelist.FileList = FileList

Lisandro Dalcín
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594

More information about the Python-3000 mailing list