import re


def libraries_from_requirements(requirements):
    """
    Clean up supplied requirements.txt and turn into tuple of CP libraries

    :param str requirements: A string version of a requirements.txt
    :return: tuple of library names
    """
    libraries = ()
    for line in requirements.split("\n"):
        line = line.lower().strip()
        if line.startswith("#") or line == "":
            # skip comments
            pass
        else:
            if any(operators in line for operators in [">", "<", "="]):
                # Remove everything after any pip style version specifiers
                line = re.split("[<|>|=|]", line)[0]
            libraries = libraries + (line,)
    return libraries