How to use _install_dependencies method in lisa

Best Python code snippet using lisa_python

packagemanager.py

Source:packagemanager.py Github

copy

Full Screen

...58 package = self._packages[package_name]59 self._check_mode(package)60 if not isinstance(package, localpackage.LocalPackage):61 raise snoing_exceptions.PackageException("Package cannot be installed by snoing. " + package.get_help_text(), package_name)62 dependencies = self._install_dependencies(package)63 package.set_dependency_paths(dependencies)64 try:65 self._logger.set_state("Downloading", package_name)66 package.download()67 self._logger.package_downloaded(package_name)68 self._logger.set_state("Installing", package_name)69 package.install()70 self._logger.package_installed(package_name)71 except snoing_exceptions.SystemException, e:72 self._logger.error(e.args[0])73 self._logger.detail(e.Details)74 raise snoing_exceptions.PackageException("Installation fail", package_name)75 return package.get_install_path()76 def install_package_dependencies(self, package_name):77 """ Install the dependencies for named package."""78 self._check_package(package_name) # Check package_name exists...79 self._install_dependencies(self._packages[package_name])80 return81 def update_package(self, package_name):82 """ Update a package and all packages that depend on it."""83 self._check_package(package_name)84 package = self._packages[package_name]85 self._check_mode(package)86 if not isinstance(package, localpackage.LocalPackage):87 raise snoing_exceptions.PackageException("Package cannot be updated by snoing. " + package.get_help_text(), package_name)88 if package.is_updated(): # Nothing todo if already updated89 return90 dependencies = self._install_dependencies( package )91 package.set_dependency_paths(dependencies)92 try:93 self._logger.set_state("Updating", package_name)94 package.update()95 except snoing_exceptions.SystemException, e:96 self._logger.error(e.args[0])97 self._logger.detail(e.Details)98 raise snoing_exceptions.PackageException("Installation fail", package_name)99 for dependent_name in self._package_dependents(package_name):100 if self.check_installed(dependent_name): #Best update this package as well101 self.update_package(dependent_name)102 def remove_package(self, package_name, force=False):103 """ Remove a package, don't remove if force is False and packages depend on package_name."""104 package = self._packages[package_name]105 self._logger.set_state("Removing", package_name)106 if force:107 package.remove()108 else:109 if not self.check_installed(package_name):110 raise snoing_exceptions.PackageException("Cannot remove, not installed.", package_name)111 if not force:112 for dependent_name in self._package_dependents(package_name):113 if self.check_installed(dependent_name):114 raise snoing_exceptions.PackageException("Cannot remove as %s depends on it." % \115 dependent_name, package_name)116 # If get here then package can be deleted117 package.remove()118####################################################################################################119 # Functions that act on all packages120 def check_all_installed(self):121 """ Check the install status of all the packages."""122 for package_name in self._packages.iterkeys():123 self.check_installed(package_name)124 def install_all(self):125 """ Install all the packages."""126 for package_name in self._packages.iterkeys():127 self.install_package(package_name)128 def update_all(self):129 """ Update all the installed packages."""130 for package_name in self._packages.iterkeys():131 self.update_package(package_name)132 def authenticate(self, username, token):133 """ Pass the authentication information over to the packages that need it."""134 for package in self._packages.itervalues():135 if isinstance(package, rat.RatRelease) or isinstance(package, rattools.RatToolsRelease) or \136 isinstance(package, xsnoed.XsnoedRelease):137 package.authenticate(username, token)138####################################################################################################139 # Internal functions140 def _check_package(self, package_name):141 """ Check a package with package_name exists."""142 if not package_name in self._packages.iterkeys():143 raise snoing_exceptions.PackageException("Package doesn't exist.", package_name)144 self._packages[package_name].check_state()145 def _check_mode(self, package):146 """ Check the package install mode is compatible with the system."""147 if isinstance(package, localpackage.LocalPackage):148 if package.get_install_mode() is not None and \149 package.get_install_mode() != self._system.get_install_mode():150 raise snoing_exceptions.PackageException(("Package install mode is incompatible with the "151 "system"),152 package.get_name())153 def install_dependencies(self, package_name):154 """ Install the dependencies (if required)"""155 self._install_dependencies(self._packages[package_name])156 def _install_dependencies(self, package):157 """ Install the dependencies (if required)."""158 dependency_paths = {} # Dictionary of dependency paths159 for dependency in package.get_dependencies():160 # First need to check if dependency is installed, if dependency is a list should check161 # at least one is installed.162 if isinstance(dependency, types.ListType): # Multiple optional dependencies163 for opt_dependency in dependency:164 if self.check_installed(opt_dependency): # Great found one!165 dependency_paths[opt_dependency] = \166 self._packages[opt_dependency].get_install_path()167 break168 else: # No optional dependency is installed, thus install the first169 dependency_paths[dependency[0]] = self.install_package(dependency[0])170 else: # Just a single dependency...

Full Screen

Full Screen

build.bzl

Source:build.bzl Github

copy

Full Screen

...28 "repo": "sgammon/bazel-pypi-package",29 "target": "91519eb2245ccdbbed91380df028b6762456099c",30 "seal": "33acfad8d98d627bb3dacdb76e903ff1c998a0c4e4c42d2c35fa4b4ff7226aea"},31}32def _install_dependencies(local):33 """ Install all dependencies into the current WORKSPACE. """34 dependencies(DEPS, local)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run lisa automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful