[PATCH] Don't copy hidden files/directories during `setup.py install`
James Abbatiello
abbeyj at gmail.com
Wed Jul 15 09:19:35 CDT 2009
On Wed, Jul 15, 2009 at 3:24 AM, Martin Geisler<mg at lazybytes.net> wrote:
> James Abbatiello <abbeyj at gmail.com> writes:
>
>> datafiles = []
>> for root in ('templates', 'i18n'):
>> for dir, dirs, files in os.walk(root):
>> + dirs[:] = [x for x in dirs if not x.startswith('.')]
>> + files = [x for x in files if not x.startswith('.')]
>
> You assign dirs in-place with the [:], but overwrite files. Is this on
> purpose?
Yes. The value left in dirs is used by os.walk() to determine which
directories to decend into. The value in files is not read back by
os.walk() and so doesn't need this.
--
James Abbatiello
More information about the Mercurial-devel
mailing list