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.
This commit is contained in:
Felipe Arruda Pontes
2017-02-11 19:24:39 -02:00
parent b3af3f06e8
commit dc02663c66
+10 -4
View File
@@ -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