예제 #1
0
 def test_in_fileset(self):
     incs = {'/common/src/*': '.scanignore'}
     excs = {'/common/src/*.so': '.scanignore'}
     assert not fileset.match(None, incs, excs)
     assert not fileset.match('', incs, excs)
     assert not fileset.match('/', incs, excs)
     assert fileset.match('/common/src/', incs, excs)
     assert not fileset.match('/common/bin/', incs, excs)
예제 #2
0
 def test_in_fileset(self):
     incs = {'/common/src/*': '.scanignore'}
     excs = {'/common/src/*.so':'.scanignore'}
     assert not fileset.match(None, incs, excs)
     assert not fileset.match('', incs, excs)
     assert not fileset.match('/', incs, excs)
     assert fileset.match('/common/src/', incs, excs)
     assert not fileset.match('/common/bin/', incs, excs)
예제 #3
0
 def test_match_sources(self):
     incs = {'/home/elf/elf-0.5/*': '.scanignore'}
     excs = {
         '/home/elf/elf-0.5/src/elf': '.scanignore',
         '/home/elf/elf-0.5/src/elf.o': '.scanignore'
     }
     assert not fileset.match('/home/elf/elf-0.5/src/elf', incs, excs)
예제 #4
0
 def test_default_ignore_does_not_skip_one_char_names(self):
     # use fileset directly to work on strings not locations
     from commoncode import fileset
     tests = [c for c in 'HFS+ Private Data'] + 'HFS+ Private Data'.split()
     for test in tests:
         assert False == fileset.match(test,
                                       includes=ignore.default_ignores,
                                       excludes={})
예제 #5
0
def is_ignored(location, ignores, unignores, skip_special=True):
    """
    Return a tuple of (pattern , message) if a file at location is ignored
    or False otherwise.
    `ignores` and `unignores` are mappings of patterns to a reason.
    """
    if skip_special and filetype.is_special(location):
        return True
    return fileset.match(location, includes=ignores, excludes=unignores)
예제 #6
0
def is_ignored(location, ignores, unignores, skip_special=True):
    """
    Return a tuple of (pattern , message) if a file at location is ignored
    or False otherwise.
    `ignores` and `unignores` are mappings of patterns to a reason.
    """
    if skip_special and filetype.is_special(location):
        return True
    return fileset.match(location, includes=ignores, excludes=unignores)
예제 #7
0
        def is_ignored(location, ignores):
            """
            Return a tuple of (pattern , message) if a file at location is ignored or
            False otherwise. `ignores` is a mappings of patterns to a reason.

            Taken from scancode/plugin_ignore.py
            """
            from commoncode.fileset import match
            return match(location, includes=ignores, excludes={})
예제 #8
0
 def test_in_fileset_2(self):
     incs = {'src*': '.scanignore'}
     excs = {'src/ab': '.scanignore'}
     assert not fileset.match(None, incs, excs)
     assert not fileset.match('', incs, excs)
     assert not fileset.match('/', incs, excs)
     assert fileset.match('/common/src/', incs, excs)
     assert not fileset.match('src/ab', incs, excs)
     assert fileset.match('src/abbab', incs, excs)
예제 #9
0
 def test_in_fileset_2(self):
     incs = {'src*': '.scanignore'}
     excs = {'src/ab': '.scanignore'}
     assert not fileset.match(None, incs, excs)
     assert not fileset.match('', incs, excs)
     assert not fileset.match('/', incs, excs)
     assert fileset.match('/common/src/', incs, excs)
     assert not fileset.match('src/ab', incs, excs)
     assert fileset.match('src/abbab', incs, excs)
예제 #10
0
 def test_match_dot_svn_with_excludes(self):
     incs = {'*/.svn/*': '.scanignore'}
     excs = {'*/.git/*': '.scanignore'}
     assert fileset.match('home/common/tools/elf/.svn/', incs, excs)
     assert fileset.match('home/common/tools/.svn/this', incs, excs)
     assert not fileset.match('home/common/.git/this', incs, excs)
예제 #11
0
 def test_match_empty_exclusions(self):
     incs = {'/src/*': '.scanignore'}
     excs = {'': '.scanignore'}
     assert fileset.match('/src/dist/build/mylib.so', incs, excs)
예제 #12
0
 def test_match_exclusions_2(self):
     incs = {'src': '.scanignore'}
     excs = {'src/*.so': '.scanignore'}
     assert fileset.match('/some/src/this/that', incs, excs)
     assert not fileset.match('/src/dist/build/mylib.so', incs, excs)
예제 #13
0
 def test_match_exclusions_2(self):
     incs = {'src': '.scanignore'}
     excs = {'src/*.so':'.scanignore'}
     assert fileset.match('/some/src/this/that', incs, excs)
     assert not fileset.match('/src/dist/build/mylib.so', incs, excs)
예제 #14
0
 def test_match_basic(self):
     assert not fileset.match('/common/src/', {}, {})
     assert not fileset.match('/common/src/', None, None)
     assert not fileset.match(None, None, None)
예제 #15
0
 def test_default_ignore_does_not_skip_one_char_names(self):
     # use fileset directly to work on strings not locations
     from commoncode import fileset
     tests = [c for c in 'HFS+ Private Data'] + 'HFS+ Private Data'.split()
     for test in tests:
         assert False == fileset.match(test, includes=ignore.default_ignores, excludes={})
예제 #16
0
 def test_match_basic(self):
     assert not fileset.match('/common/src/', {}, {})
     assert not fileset.match('/common/src/', None, None)
     assert not fileset.match(None, None, None)
예제 #17
0
def is_ignored(location, ignores):
    """
    Return a tuple of (pattern , message) if a file at location is ignored or
    False otherwise. `ignores` is a mappings of patterns to a reason.
    """
    return match(location, includes=ignores, excludes={})
예제 #18
0
 def test_match_dot_svn_with_excludes(self):
     incs = {'*/.svn/*': '.scanignore'}
     excs = {'*/.git/*': '.scanignore'}
     assert fileset.match('home/common/tools/elf/.svn/', incs, excs)
     assert fileset.match('home/common/tools/.svn/this', incs, excs)
     assert not fileset.match('home/common/.git/this', incs, excs)
예제 #19
0
 def test_match_sources(self):
     incs = {'/home/elf/elf-0.5/*': '.scanignore'}
     excs = {'/home/elf/elf-0.5/src/elf': '.scanignore',
             '/home/elf/elf-0.5/src/elf.o': '.scanignore'}
     assert not fileset.match('/home/elf/elf-0.5/src/elf', incs, excs)
예제 #20
0
 def test_match_empty_exclusions(self):
     incs = {'/src/*': '.scanignore'}
     excs = {'': '.scanignore'}
     assert fileset.match('/src/dist/build/mylib.so', incs, excs)