~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_source.py

  • Committer: Martin Pool
  • Date: 2011-06-28 22:25:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6004.
  • Revision ID: mbp@canonical.com-20110628222528-gwf27vdagmxatljc
More explicit laziness

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
 
41
41
# Files which are listed here will be skipped when testing for Copyright (or
42
42
# GPL) statements.
43
 
COPYRIGHT_EXCEPTIONS = ['bzrlib/lsprof.py', 'bzrlib/_bencode_py.py',
44
 
    'bzrlib/doc_generate/sphinx_conf.py']
 
43
COPYRIGHT_EXCEPTIONS = [
 
44
    'bzrlib/_bencode_py.py',
 
45
    'bzrlib/doc_generate/conf.py',
 
46
    'bzrlib/lsprof.py',
 
47
    ]
45
48
 
46
 
LICENSE_EXCEPTIONS = ['bzrlib/lsprof.py', 'bzrlib/_bencode_py.py',
47
 
    'bzrlib/doc_generate/sphinx_conf.py']
 
49
LICENSE_EXCEPTIONS = [
 
50
    'bzrlib/_bencode_py.py',
 
51
    'bzrlib/doc_generate/conf.py',
 
52
    'bzrlib/lsprof.py',
 
53
    ]
48
54
# Technically, 'bzrlib/lsprof.py' should be 'bzrlib/util/lsprof.py',
49
55
# (we do not check bzrlib/util/, since that is code bundled from elsewhere)
50
56
# but for compatibility with previous releases, we don't want to move it.
382
388
        """
383
389
        both_exc_and_no_exc = []
384
390
        missing_except = []
385
 
        class_re = re.compile(r'^(cdef\s+)?(public\s+)?(api\s+)?class (\w+).*:',
386
 
                              re.MULTILINE)
 
391
        class_re = re.compile(r'^(cdef\s+)?(public\s+)?'
 
392
                              r'(api\s+)?class (\w+).*:', re.MULTILINE)
 
393
        extern_class_re = re.compile(r'## extern cdef class (\w+)',
 
394
                                     re.MULTILINE)
387
395
        except_re = re.compile(r'cdef\s+' # start with cdef
388
396
                               r'([\w *]*?)\s*' # this is the return signature
389
397
                               r'(\w+)\s*\(' # the function name
394
402
        for fname, text in self.get_source_file_contents(
395
403
                extensions=('.pyx',)):
396
404
            known_classes = set([m[-1] for m in class_re.findall(text)])
 
405
            known_classes.update(extern_class_re.findall(text))
397
406
            cdefs = except_re.findall(text)
398
407
            for sig, func, exc_clause, no_exc_comment in cdefs:
399
408
                if sig.startswith('api '):