import re


def parse_dependency_links(file_name):
    """Parses a pip requirements file and returns a list of dependencies.

    Use the result of this function in the ``dependency_links`` field.
    Copied from cburgmer/pdfserver.

    """
    dependency_links = []
    for line in open(file_name, 'r').read().split('\n'):
        if re.match(r'\s*-[ef]\s+', line):
            dependency_links.append(re.sub(r'\s*-[ef]\s+', '', line))

    return dependency_links