Merge pull request #50 from blueboxgroup/postinstall-deps

Support postinstall python dependencies
This commit is contained in:
Paul Czarkowski 2015-10-09 22:59:06 -05:00
commit 75098e9c1d
4 changed files with 20 additions and 1 deletions

View File

@ -72,6 +72,9 @@ class Builder(object):
self._install_project(project.install_path, src_clone_dir)
if project.postinstall_dependencies:
self._install_postinstall_dependencies(project)
# finish up
self._finalize_project_build(project)
@ -144,6 +147,10 @@ class Builder(object):
def _install_project(self, venv_path, src_clone_dir):
return
@abstractmethod
def _install_postinstall_dependencies(self, project):
return
@abstractmethod
def _finalize_project_build(self, project):
return

View File

@ -97,6 +97,11 @@ class DockerBuilder(Builder):
pip_path = self._get_venv_pip_path(venv_path)
self._execute("%s install %s" % (pip_path, src_clone_dir))
def _install_postinstall_dependencies(self, project):
pip_path = self._get_venv_pip_path(project.install_path)
dependencies = " ".join(project.postinstall_dependencies)
self._execute("%s install %s" % (pip_path, dependencies))
def _finalize_project_build(self, project):
self._commands.append("rm -rf %s" % self._temp_dir)
for command in self._commands:

View File

@ -88,6 +88,11 @@ class PackageBuilder(Builder):
pip_path = self._get_venv_pip_path(venv_path)
self._execute("%s install %s" % (pip_path, src_clone_dir))
def _install_postinstall_dependencies(self, project):
pip_path = self._get_venv_pip_path(project.install_path)
dependencies = " ".join(project.postinstall_dependencies)
self._execute("%s install %s" % (pip_path, dependencies))
def _finalize_project_build(self, project):
# build the package
pkg = Package(project.package_name, project.version,

View File

@ -34,7 +34,8 @@ class OpenstackProject(object):
def __init__(self, settings, name, version=None, gitref=None, giturl=None,
gitdepth=1, venv_command=None, install_command=None,
install_path=None, package_name=None, stackforge=False,
system_dependencies=[], pip_dependencies=[]):
system_dependencies=[], pip_dependencies=[],
postinstall_dependencies=[]):
self._settings = settings
self.name = name
self._version = version
@ -49,6 +50,7 @@ class OpenstackProject(object):
self._git_path = None
self.system_dependencies = system_dependencies
self.pip_dependencies = pip_dependencies
self.postinstall_dependencies = postinstall_dependencies
@property
def version(self):