def METHOD_NAME(filename):
    line_matcher = re.compile("^([+-g]) (.*)$")
    dependencies = {}
    f = open(filename, 'r')
    glob = None
    globs = {}
    for line in f:
        if line[0] == '#': continue
        m = line_matcher.match(line)
        path = m.group(2)
        if not m:
            raise Exception("Invalid dependency file: %1s" % filename)
        if m.group(1) == 'g':
            globs[path] = []
            glob = path
        elif glob:
            if m.group(1) != '+':
                raise Exception("Negative match in glob.")
            globs[glob].append(path)
        else:
            found = m.group(1) == '+'
            if path in dependencies:
                raise Exception("Duplicate path (%1s) in %2s" % (path, filename))
            dependencies[path] = found
    return { 'dependencies': dependencies, 'globs': globs }