def parse_requirements(output, filepath):
    """
    """

    try:
        with open(filepath) as filehandle:
            dependencies = filehandle.read().splitlines()
            msg = ""
            for dependency in dependencies:
                if dependency[0] == "#":
                    # either a normal comment or custom message
                    if dependency[:9] == "# Warning" or dependency[7] == "# Error:":
                        msg = dependency.split(":", 1)[1]
                else:
                    import re
                    # Check if the module name is different from the package name
                    if "#" in dependency:
                        dep = dependency.split("#", 1)[1]
                        output[dep] = msg
                    else:
                        pattern = re.compile(r'([A-Za-z0-9_-]+)')
                        try:
                            dep = pattern.match(dependency).group(1)
                            output[dep] = msg
                        except __HOLE__:
                            # Invalid dependency syntax
                            pass
                    msg = ""
    except IOError:
        # No override for Template
        pass

    return output

# -------------------------------------------------------------------------
dataset/ETHPy150Open sahana/eden/modules/s3_update_check.py/parse_requirements