def split_requirement(requirement):
    """split a requirements line such as "foo<7,>2; sys_platform == 'win32'" into
    ("foo", "<7,>2", "sys_platform == 'win32'")"""
    splitchars =' \t~<>=!;'
    name = requirement
    for char in splitchars:
        name = name.split(char, 1)[0].strip()
    rest = requirement[len(name) :].strip()
    if not rest:
        version_specifiers = env_marker = ""
    elif ';' in rest:
        version_specifiers, env_marker = rest.split(';', 1)
    else:
        version_specifiers = rest
        env_marker = ""
    if not version_specifiers.strip():
        version_specifiers = None
    if not env_marker.strip():
        env_marker = None
    return name, version_specifiers, env_marker