From dc02663c6689d91ee0d2c73623196160c213e47e Mon Sep 17 00:00:00 2001 From: Felipe Arruda Pontes Date: Sat, 11 Feb 2017 19:24:39 -0200 Subject: [PATCH] making `cli.proper_case` use a new method that runs through all sources in project.sources, and return the Request's return for the first one that hit OK, or neither did ok, then raise an exception. Also doing something similar to `cli.pip_install` so that it will try to pip install for all the sources and return the first cmd that worked or the last that didn't work. --- pipenv/cli.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pipenv/cli.py b/pipenv/cli.py index 3d0ba661..c0c5bd81 100644 --- a/pipenv/cli.py +++ b/pipenv/cli.py @@ -551,10 +551,16 @@ def do_init(dev=False, requirements=False, skip_virtualenv=False, allow_global=F def pip_install(package_name=None, r=None, allow_global=False): - if r: - c = delegator.run('{0} install -r {1} --require-hashes -i {2}'.format(which_pip(allow_global=allow_global), r, project.source['url'])) - else: - c = delegator.run('{0} install "{1}" -i {2}'.format(which_pip(allow_global=allow_global), package_name, project.source['url'])) + # try installing for each source in project.sources + for source in project.sources: + if r: + c = delegator.run('{0} install -r {1} --require-hashes -i {2}'.format(which_pip(allow_global=allow_global), r, source['url'])) + else: + c = delegator.run('{0} install "{1}" -i {2}'.format(which_pip(allow_global=allow_global), package_name, source['url'])) + + if c.return_code == 0: + break + # return the result of the first one that runs ok or the last one that didn't work return c