#!/usr/bin/env python

"""
Install the packages you have listed in the requirements file you input as
first argument.
"""

from __future__ import (absolute_import, division, print_function,
                        unicode_literals)

import sys
import fileinput
import subprocess
from pip.req import parse_requirements
import uuid


def get_requirements(*args):
    """Parse all requirements files given and return a list of the dependencies"""
    install_deps = []
    try:
        for fpath in args:
            install_deps.extend([str(d.req or d.url) for d in parse_requirements(fpath, session=uuid.uuid1())])
    except:
        print('Error reading {} file looking for dependencies.'.format(fpath))

    return [dep for dep in install_deps if dep != 'None']


if __name__ == '__main__':

    for line in fileinput.input():
        req_filepaths = sys.argv[1:]

    deps = get_requirements(*req_filepaths)

    try:
        for dep_name in deps:
            cmd = "pip install '{0}'".format(dep_name)
            print('#', cmd)
            subprocess.check_call(cmd, shell=True)
    except:
        print('Error installing {}'.format(dep_name))

@@ -541,17 +541,8 @@
 .req
- or d.url
 ) fo

remove URLs from install_deps.py, dont work with setuptools