[issue6884] Impossible to include file in sdist that starts with 'build' on Win32

Nadeem Vawda report at bugs.python.org
Mon Feb 20 13:58:28 CET 2012


Nadeem Vawda <nadeem.vawda at gmail.com> added the comment:

> (2.7.2 doesn’t include neither Antoine’s changeset nor mine, right?)

Correct; it dates back to June last year, before issue 13193 was filed.


> Can you reproduce the “include buildout.cfg” bug too?

Yes, that problem is present in 2.7.2, but not in the current revision of
the 2.7 branch. In 2.7.2, the offending regex is r'^build\.*' (since
translate_pattern() uses os.path.join, and doesn't escape the separator),
whereas in 2.7-head the regex is r'^build/.*' (using a hardcoded "/").
2.7-head with your patch applied gives r'^build\\.*' (the correct value).

In this case (unlike #9691 and #14004), the problem was fixed by the
changes in issue 13193, since the offending code is in the
"if prefix is not None:" codepath of translate_pattern(), rather than in
glob_to_re().


While we're talking about translate_pattern(), I have a question about
this line:

    pattern_re = "^%s/.*%s" % (prefix_re, pattern_re)

It seems that if you specify both a prefix and a (nonempty) pattern, the
resulting regexp is something like "<PREFIX>/.*<PATTERN>", using the
pattern argument as a suffix. Is this the intended behavior? I would have
expected something like "<PREFIX>/(.*/)?<PATTERN>", defaulting to
"<PREFIX>/.*" if pattern is empty. For example, it seems wrong that
"recursive-include foo bar.*" matches foo/test_bar.py.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6884>
_______________________________________


More information about the Python-bugs-list mailing list