def check_header_files(component):
    component_dir = os.path.join(SRC_DIR, component)
    header_files = (glob.glob(os.path.join(component_dir, '*.h')) + glob.glob(os.path.join(component_dir, '*', '*.h')))
    assert header_files
    errors = []
    for filename in header_files:
        assert filename.endswith('.h'), filename
        rel_filename = os.path.relpath(filename, start=component_dir)
        guard = rel_filename.replace('.', '_').replace('/', '_').replace('-', '_').upper()
        expected = ('#ifndef ' + guard)
        for line in open(filename):
            line = line.rstrip('\n')
            if line.startswith('#ifndef'):
                if (line != expected):
                    errors.append(('%s uses guard "%s" but should use "%s"' % (filename, line, expected)))
                break
    return errors
def check_header_files(component):
    component_dir = os.path.join(SRC_DIR, component)
    header_files = (glob.glob(os.path.join(component_dir, '*.h')) + glob.glob(os.path.join(component_dir, '*', '*.h')))
    assert header_files
    errors = []
    for filename in header_files:
        assert filename.endswith('.h'), filename
        rel_filename = os.path.relpath(filename, start=component_dir)
        guard = rel_filename.replace('.', '_').replace('/', '_').replace('-', '_').upper()
        expected = ('#ifndef ' + guard)
        for line in open(filename):
            line = line.rstrip('\n')
            if line.startswith('#ifndef'):
                if (line != expected):
                    errors.append(('%s uses guard "%s" but should use "%s"' % (filename, line, expected)))
                break
    return errors