Load werkzeug.

def load_werkzeug(path):
    """Load werkzeug."""
    sys.path[0] = path

    # get rid of already imported stuff
    wz.__dict__.clear()
    for key in sys.modules.keys():
        if key.startswith("werkzeug.") or key == "werkzeug":
            sys.modules.pop(key, None)

    # import werkzeug again.
    import werkzeug

    for key in werkzeug.__all__:
        setattr(wz, key, getattr(werkzeug, key))

    # get the hg tag
    hg_tag = find_hg_tag(path)

    # get the real version from the setup file
    try:
        f = open(os.path.join(path, "setup.py"))
    except IOError:
        pass
    else:
        try:
            for line in f:
                line = line.strip()
                if line.startswith("version="):
                    return line[8:].strip(" \t,")[1:-1], hg_tag
        finally:
            f.close()
    print("Unknown werkzeug version loaded", file=sys.stderr)
    sys.exit(2)