diff options
author | Monty Taylor <mordred@inaugust.com> | 2013-07-04 22:50:11 -0400 |
---|---|---|
committer | Monty Taylor <mordred@inaugust.com> | 2013-07-11 16:42:18 -0400 |
commit | d88c6f803a20205f3b065b4e6684c1ef67506a8f (patch) | |
tree | 755241ad4b154085defe4991f2d4eb3883456d43 | |
parent | 746b78d637724b369477270f518aa09768c5124e (diff) | |
download | pbr-d88c6f803a20205f3b065b4e6684c1ef67506a8f.tar.gz |
Don't run pip needlessly
We can detect if the env we are a part of has our requirements met
already. If this is the case, don't re-run pip at all, so that we
don't waste time.
Change-Id: If49cd7bd558f98d8e6f51b0fe0192978bee9c77e
-rw-r--r-- | pbr/packaging.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/pbr/packaging.py b/pbr/packaging.py index 815f060..3a6fe7d 100644 --- a/pbr/packaging.py +++ b/pbr/packaging.py @@ -95,13 +95,15 @@ def _pip_install(links, requires, root=None): root_cmd = "" if root: root_cmd = "--root=%s" % root - _run_shell_command( - "%s -m pip.__init__ install %s %s %s" % ( - sys.executable, - root_cmd, - " ".join(links), - " ".join(_wrap_in_quotes(_missing_requires(requires)))), - throw_on_error=True, buffer=False) + missing_requires = _missing_requires(requires) + if missing_requires: + _run_shell_command( + "%s -m pip.__init__ install %s %s %s" % ( + sys.executable, + root_cmd, + " ".join(links), + " ".join(_wrap_in_quotes(missing_requires))), + throw_on_error=True, buffer=False) def read_git_mailmap(git_dir, mailmap='.mailmap'): |