Remove contraints from postinstall_dependencies

postinstall_dependencies is meant for very fine-grained modification of
the resulting virtual environment. If a user wants to use constraints
after the fact they may then specify those constraints in the
postinstall_dependencies list item.

Change-Id: I21390450fc086d80b16c7ab4d1dc43c81ff590af
This commit is contained in:
Craig Tracey 2016-06-20 13:29:32 -04:00
parent 4946801f16
commit 56c0208a9c
3 changed files with 15 additions and 8 deletions

View File

@ -112,7 +112,7 @@ class Builder(object):
if project.postinstall_dependencies:
dependencies = project.postinstall_dependencies
self._install_pip_dependencies(project.install_path,
dependencies)
dependencies, False)
# finish up
self._finalize_project_build(project)
@ -188,7 +188,8 @@ class Builder(object):
return
@abstractmethod
def _install_pip_dependencies(self, venv_path, dependencies):
def _install_pip_dependencies(self, venv_path, dependencies,
use_constraints=True):
return
@abstractmethod

View File

@ -82,11 +82,14 @@ class DockerBuilder(Builder):
def _create_virtualenv(self, venv_command, path):
self._execute(venv_command, path)
def _install_pip_dependencies(self, venv_path, dependencies):
def _install_pip_dependencies(self, venv_path, dependencies,
use_constraints=True):
pip_path = self._get_venv_pip_path(venv_path)
install = "install"
for constraint in self._constraints:
install = "%s -c %s" % (install, constraint)
if use_constraints:
for constraint in self._constraints:
install = "%s -c %s" % (install, constraint)
for dependency in dependencies:
self._execute("%s %s %s" % (pip_path, install, dependency))

View File

@ -68,11 +68,14 @@ class PackageBuilder(Builder):
def _create_virtualenv(self, venv_command, path):
self._execute(venv_command, path)
def _install_pip_dependencies(self, venv_path, dependencies):
def _install_pip_dependencies(self, venv_path, dependencies,
use_constraints=True):
pip_path = self._get_venv_pip_path(venv_path)
install = "install"
for constraint in self._constraints:
install = "%s -c %s" % (install, constraint)
if use_constraints:
for constraint in self._constraints:
install = "%s -c %s" % (install, constraint)
for dependency in dependencies:
self._execute("%s %s %s" % (pip_path, install, dependency))