Nadeem Vawda <nadeem.va...@gmail.com> added the comment:

Test output:

    test test_distutils failed -- Traceback (most recent call last):
      File 
"C:\Users\Nadeem\Code\python2\python27\lib\distutils\tests\test_filelist.py", 
line 230, in test_process_template
        self.assertEqual(file_list.files, ['d/b.py', 'd/d/e.py'])
    AssertionError: Lists differ: [] != ['d/b.py', 'd/d/e.py']

    Second list contains 2 additional elements.
    First extra element 0:
    d/b.py

    - []
    + ['d/b.py', 'd/d/e.py']

Output of sdist:

    C:\Users\Nadeem\Code\keyring>..\python2\python27\PCbuild\python_d setup.py 
sdist

    C:\Users\Nadeem\Code\python2\python27\lib\distutils\dist.py:267: 
UserWarning: Unknown distribution option: 'extras_require'
      warnings.warn(msg)
    options (after parsing config files):
    options (after parsing command line):
    option dict for 'sdist' command:
      {}
    running sdist
    Distribution.get_command_obj(): creating 'sdist' command object
    running check
    Distribution.get_command_obj(): creating 'check' command object
    Distribution.get_command_obj(): creating 'build_py' command object
    Distribution.get_command_obj(): creating 'build' command object
    reading manifest template 'MANIFEST.in'
[... output omitted - applying other regexes ...]
    include *.txt
    include_pattern: applying regex r'^[^/]*\.txt\Z(?ms)'
     adding CHANGES.txt
     adding CONTRIBUTORS.txt
     adding .hg\last-message.txt
    exclude_pattern: applying regex r'^build\\.*'
    exclude_pattern: applying regex r'^keyring\-0\.8\\.*'
    exclude_pattern: applying regex 
r'(^|/|\\)(RCS|CVS|\.svn|\.hg|\.git|\.bzr|_darcs)(/|\\).*'
     removing .hg\last-message.txt
    writing manifest file 'MANIFEST'
[... output omitted - creating directories; copying and adding files ...]
    removing 'keyring-0.8' (and everything under it)

As you can see, the "include *.txt" directive still catches 
".hg\last-message.txt".

The problem seems to be that while you've fixed the prefix-handling codepath in
translate_pattern(), glob_to_re() is still hardcoded to use "/". I've been able 
to
get the desired behavior by changing glob_to_re() as follows (note the need to
double-escape os.sep):

         # character except the special characters.
         # XXX currently the "special characters" are just slash -- i.e. this is
         # Unix-only.
    -    pattern_re = re.sub(r'((?<!\\)(\\\\)*)\.', r'\1[^/]', pattern_re)
    +    pattern_re = re.sub(r'((?<!\\)(\\\\)*)\.',
    +                        r'\1[^' + re.escape(re.escape(os.sep)) + ']',
    +                        pattern_re)
    
         return pattern_re

Of course, the comment above should also be updated.

Also, this change results in a different set of test breakages:

    ======================================================================
    FAIL: test_glob_to_re (distutils.tests.test_filelist.FileListTestCase)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File 
"C:\Users\Nadeem\Code\python2\python27\lib\distutils\tests\test_filelist.py", 
line 42, in test_glob_to_re
        self.assertEqual(glob_to_re('foo*'), 'foo[^/]*\\Z(?ms)')
    AssertionError: 'foo[^\\\\]*\\Z(?ms)' != 'foo[^/]*\\Z(?ms)'

    ======================================================================
    FAIL: test_process_template (distutils.tests.test_filelist.FileListTestCase)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File 
"C:\Users\Nadeem\Code\python2\python27\lib\distutils\tests\test_filelist.py", 
line 182, in test_process_template
        self.assertEqual(file_list.files, ['a.py'])
    AssertionError: Lists differ: ['a.py', 'd/c.py'] != ['a.py']

    First list contains 1 additional elements.
    First extra element 1:
    d/c.py

    - ['a.py', 'd/c.py']
    + ['a.py']

These are both clearly due to the tests using hardcoded Unix paths instead
of os.sep and os.path.join().

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue6884>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to