Bug 1306614 - Correctly detect when a conflicting version of a python package is found by the build system's virtualenv. r=gps
authorChris Manchester <cmanchester@mozilla.com>
Mon, 28 Nov 2016 13:05:19 -0800
changeset 324555 e9e311eb0f84485885fbfac3c2f9b4b81736388f
parent 324554 89d9fb5f381b6476267f2a79f889c63a4d9992ec
child 324556 a84f47c9a0e017b522a8298fbc9a1bbc77a97fe3
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersgps
bugs1306614
milestone53.0a1
Bug 1306614 - Correctly detect when a conflicting version of a python package is found by the build system's virtualenv. r=gps The pip function `check_if_exists` returns True if any version of the named package exists, and sets attributes on the requirement object based on whether the correct version exists. Prior to this patch, we were interpreting a `True` result from `check_if_exists` to mean the named package did not need to be installed or updated at all, causing the build system virtualenv to use incorrect dependency versions and fail in some cases. This was found in the case of attempting an artifact build on a system where mozregression was installed locally, resulting in an incompatible version of the taskcluster client being used by the artifact code. MozReview-Commit-ID: 5Q54PsUIrKR
python/mozbuild/mozbuild/virtualenv.py
--- a/python/mozbuild/mozbuild/virtualenv.py
+++ b/python/mozbuild/mozbuild/virtualenv.py
@@ -471,17 +471,18 @@ class VirtualenvManager(object):
         The supplied package is specified using a pip requirement specifier.
         e.g. 'foo' or 'foo==1.0'.
 
         If the package is already installed, this is a no-op.
         """
         from pip.req import InstallRequirement
 
         req = InstallRequirement.from_line(package)
-        if req.check_if_exists():
+        req.check_if_exists()
+        if req.satisfied_by is not None:
             return
 
         args = [
             'install',
             '--use-wheel',
             package,
         ]