Handle multiple requirements for one package

Sometimes a developer needs to install dependencies for several packages, and each of them has its own requirements.txt file. A good example can be OpenStack - a Python project that has the largest open source community.

Often, the same package is referenced in several files, possibly with different version requirements:

$ cat a/requirements.txt
prettytable>=0.6
$ cat b/requirements.txt
prettytable<0.8

pip should install prettytable>=0.6,<0.8, but it will just complain:

$ pip install -r a/requirements.txt -r b/requirements.txt 
Double requirement given: prettytable<0.8 (from -r b/requirements.txt (line 1)) (already in prettytable>=0.6 (from -r a/requirements.txt (line 1)), name='prettytable')

My patch fixes the problem:

pip install -r a/requirements.txt -r b/requirements.txt 
Downloading/unpacking prettytable>=0.6,<0.8 (from aggregated requirements)
  Downloading prettytable-0.7.2.zip
...