How to use _get_installed_version_from_module method in autotest

Best Python code snippet using autotest_python

external_packages.py

Source:external_packages.py Github

copy

Full Screen

...117 'module will be forced to be installed in %s.',118 self.module_name, module.__file__, install_dir,119 install_dir)120 return True121 self.installed_version = self._get_installed_version_from_module(module)122 logging.info('imported %s version %s.', self.module_name,123 self.installed_version)124 if hasattr(self, 'minimum_version'):125 return self.minimum_version > self.installed_version126 else:127 return self.version > self.installed_version128 def _get_installed_version_from_module(self, module):129 """Ask our module its version string and return it or '' if unknown."""130 try:131 return module.__version__132 except AttributeError:133 logging.error('could not get version from %s', module)134 return ''135 def _build_and_install(self, install_dir):136 """Subclasses MUST provide their own implementation."""137 raise NotImplementedError138 def _build_and_install_current_dir(self, install_dir):139 """140 Subclasses that use _build_and_install_from_package() MUST provide141 their own implementation of this method.142 """143 raise NotImplementedError144 def build_and_install(self, install_dir):145 """146 Builds and installs the package. It must have been fetched already.147 @param install_dir - The package installation directory. If it does148 not exist it will be created.149 """150 if not self.verified_package:151 raise Error('Must call fetch() first. - %s' % self.name)152 self._check_os_requirements()153 return self._build_and_install(install_dir)154 def _check_os_requirements(self):155 if not self.os_requirements:156 return157 failed = False158 for file_names, package_name in self.os_requirements.iteritems():159 if not any(os.path.exists(file_name) for file_name in file_names):160 failed = True161 logging.error('Can\'t find %s, %s probably needs it.',162 ' or '.join(file_names), self.name)163 logging.error('Perhaps you need to install something similar '164 'to the %s package for OS first.', package_name)165 if failed:166 raise Error('Missing OS requirements for %s. (see above)' %167 self.name)168 def _build_and_install_current_dir_setup_py(self, install_dir):169 """For use as a _build_and_install_current_dir implementation."""170 egg_path = self._build_egg_using_setup_py(setup_py='setup.py')171 if not egg_path:172 return False173 return self._install_from_egg(install_dir, egg_path)174 def _build_and_install_current_dir_setupegg_py(self, install_dir):175 """For use as a _build_and_install_current_dir implementation."""176 egg_path = self._build_egg_using_setup_py(setup_py='setupegg.py')177 if not egg_path:178 return False179 return self._install_from_egg(install_dir, egg_path)180 def _build_and_install_current_dir_noegg(self, install_dir):181 if not self._build_using_setup_py():182 return False183 return self._install_using_setup_py_and_rsync(install_dir)184 def _build_and_install_from_package(self, install_dir):185 """186 This method may be used as a _build_and_install() implementation187 for subclasses if they implement _build_and_install_current_dir().188 Extracts the .tar.gz file, chdirs into the extracted directory189 (which is assumed to match the tar filename) and calls190 _build_and_isntall_current_dir from there.191 Afterwards the build (regardless of failure) extracted .tar.gz192 directory is cleaned up.193 @returns True on success, False otherwise.194 @raises OSError If the expected extraction directory does not exist.195 """196 self._extract_compressed_package()197 if self.verified_package.endswith('.tar.gz'):198 extension = '.tar.gz'199 elif self.verified_package.endswith('.tar.bz2'):200 extension = '.tar.bz2'201 elif self.verified_package.endswith('.zip'):202 extension = '.zip'203 else:204 raise Error('Unexpected package file extension on %s' %205 self.verified_package)206 os.chdir(os.path.dirname(self.verified_package))207 os.chdir(self.local_filename[:-len(extension)])208 extracted_dir = os.getcwd()209 try:210 return self._build_and_install_current_dir(install_dir)211 finally:212 os.chdir(os.path.join(extracted_dir, '..'))213 shutil.rmtree(extracted_dir)214 def _extract_compressed_package(self):215 """Extract the fetched compressed .tar or .zip within its directory."""216 if not self.verified_package:217 raise Error('Package must have been fetched first.')218 os.chdir(os.path.dirname(self.verified_package))219 if self.verified_package.endswith('gz'):220 status = system("tar -xzf '%s'" % self.verified_package)221 elif self.verified_package.endswith('bz2'):222 status = system("tar -xjf '%s'" % self.verified_package)223 elif self.verified_package.endswith('zip'):224 status = system("unzip '%s'" % self.verified_package)225 else:226 raise Error('Unknown compression suffix on %s.' %227 self.verified_package)228 if status:229 raise Error('tar failed with %s' % (status,))230 def _build_using_setup_py(self, setup_py='setup.py'):231 """232 Assuming the cwd is the extracted python package, execute a simple233 python setup.py build.234 @param setup_py - The name of the setup.py file to execute.235 @returns True on success, False otherwise.236 """237 if not os.path.exists(setup_py):238 raise Error('%s does not exist in %s' % (setup_py, os.getcwd()))239 status = system("'%s' %s build" % (sys.executable, setup_py))240 if status:241 logging.error('%s build failed.', self.name)242 return False243 return True244 def _build_egg_using_setup_py(self, setup_py='setup.py'):245 """246 Assuming the cwd is the extracted python package, execute a simple247 python setup.py bdist_egg.248 @param setup_py - The name of the setup.py file to execute.249 @returns The relative path to the resulting egg file or '' on failure.250 """251 if not os.path.exists(setup_py):252 raise Error('%s does not exist in %s' % (setup_py, os.getcwd()))253 egg_subdir = 'dist'254 if os.path.isdir(egg_subdir):255 shutil.rmtree(egg_subdir)256 status = system("'%s' %s bdist_egg" % (sys.executable, setup_py))257 if status:258 logging.error('bdist_egg of setuptools failed.')259 return ''260 # I've never seen a bdist_egg lay multiple .egg files.261 for filename in os.listdir(egg_subdir):262 if filename.endswith('.egg'):263 return os.path.join(egg_subdir, filename)264 def _install_from_egg(self, install_dir, egg_path):265 """266 Install a module from an egg file by unzipping the necessary parts267 into install_dir.268 @param install_dir - The installation directory.269 @param egg_path - The pathname of the egg file.270 """271 status = system("unzip -q -o -d '%s' '%s'" % (install_dir, egg_path))272 if status:273 logging.error('unzip of %s failed', egg_path)274 return False275 egg_info = os.path.join(install_dir, 'EGG-INFO')276 if os.path.isdir(egg_info):277 shutil.rmtree(egg_info)278 return True279 def _get_temp_dir(self):280 return tempfile.mkdtemp(dir='/var/tmp')281 def _site_packages_path(self, temp_dir):282 # This makes assumptions about what python setup.py install283 # does when given a prefix. Is this always correct?284 python_xy = 'python%s' % sys.version[:3]285 return os.path.join(temp_dir, 'lib', python_xy, 'site-packages')286 def _rsync (self, temp_site_dir, install_dir):287 """Rsync contents. """288 status = system("rsync -r '%s/' '%s/'" %289 (os.path.normpath(temp_site_dir),290 os.path.normpath(install_dir)))291 if status:292 logging.error('%s rsync to install_dir failed.', self.name)293 return False294 return True295 def _install_using_setup_py_and_rsync(self, install_dir,296 setup_py='setup.py',297 temp_dir=None):298 """299 Assuming the cwd is the extracted python package, execute a simple:300 python setup.py install --prefix=BLA301 BLA will be a temporary directory that everything installed will302 be picked out of and rsynced to the appropriate place under303 install_dir afterwards.304 Afterwards, it deconstructs the extra lib/pythonX.Y/site-packages/305 directory tree that setuptools created and moves all installed306 site-packages directly up into install_dir itself.307 @param install_dir the directory for the install to happen under.308 @param setup_py - The name of the setup.py file to execute.309 @returns True on success, False otherwise.310 """311 if not os.path.exists(setup_py):312 raise Error('%s does not exist in %s' % (setup_py, os.getcwd()))313 if temp_dir is None:314 temp_dir = self._get_temp_dir()315 try:316 status = system("'%s' %s install --no-compile --prefix='%s'"317 % (sys.executable, setup_py, temp_dir))318 if status:319 logging.error('%s install failed.', self.name)320 return False321 if os.path.isdir(os.path.join(temp_dir, 'lib')):322 # NOTE: This ignores anything outside of the lib/ dir that323 # was installed.324 temp_site_dir = self._site_packages_path(temp_dir)325 else:326 temp_site_dir = temp_dir327 return self._rsync(temp_site_dir, install_dir)328 finally:329 shutil.rmtree(temp_dir)330 def _build_using_make(self, install_dir):331 """Build the current package using configure/make.332 @returns True on success, False otherwise.333 """334 install_prefix = os.path.join(install_dir, 'usr', 'local')335 status = system('./configure --prefix=%s' % install_prefix)336 if status:337 logging.error('./configure failed for %s', self.name)338 return False339 status = system('make')340 if status:341 logging.error('make failed for %s', self.name)342 return False343 status = system('make check')344 if status:345 logging.error('make check failed for %s', self.name)346 return False347 return True348 def _install_using_make(self):349 """Install the current package using make install.350 Assumes the install path was set up while running ./configure (in351 _build_using_make()).352 @returns True on success, False otherwise.353 """354 status = system('make install')355 return status == 0356 def fetch(self, dest_dir):357 """358 Fetch the package from one its URLs and save it in dest_dir.359 If the the package already exists in dest_dir and the checksum360 matches this code will not fetch it again.361 Sets the 'verified_package' attribute with the destination pathname.362 @param dest_dir - The destination directory to save the local file.363 If it does not exist it will be created.364 @returns A boolean indicating if we the package is now in dest_dir.365 @raises FetchError - When something unexpected happens.366 """367 if not os.path.exists(dest_dir):368 os.makedirs(dest_dir)369 local_path = os.path.join(dest_dir, self.local_filename)370 # If the package exists, verify its checksum and be happy if it is good.371 if os.path.exists(local_path):372 actual_hex_sum = _checksum_file(local_path)373 if self.hex_sum == actual_hex_sum:374 logging.info('Good checksum for existing %s package.',375 self.name)376 self.verified_package = local_path377 return True378 logging.warning('Bad checksum for existing %s package. '379 'Re-downloading', self.name)380 os.rename(local_path, local_path + '.wrong-checksum')381 # Download the package from one of its urls, rejecting any if the382 # checksum does not match.383 for url in self.urls:384 logging.info('Fetching %s', url)385 try:386 url_file = urllib2.urlopen(url)387 except (urllib2.URLError, EnvironmentError):388 logging.warning('Could not fetch %s package from %s.',389 self.name, url)390 continue391 data_length = int(url_file.info().get('Content-Length',392 _MAX_PACKAGE_SIZE))393 if data_length <= 0 or data_length > _MAX_PACKAGE_SIZE:394 raise FetchError('%s from %s fails Content-Length %d '395 'sanity check.' % (self.name, url,396 data_length))397 checksum = utils.hash('sha1')398 total_read = 0399 output = open(local_path, 'wb')400 try:401 while total_read < data_length:402 data = url_file.read(_READ_SIZE)403 if not data:404 break405 output.write(data)406 checksum.update(data)407 total_read += len(data)408 finally:409 output.close()410 if self.hex_sum != checksum.hexdigest():411 logging.warning('Bad checksum for %s fetched from %s.',412 self.name, url)413 logging.warning('Got %s', checksum.hexdigest())414 logging.warning('Expected %s', self.hex_sum)415 os.unlink(local_path)416 continue417 logging.info('Good checksum.')418 self.verified_package = local_path419 return True420 else:421 return False422# NOTE: This class definition must come -before- all other ExternalPackage423# classes that need to use this version of setuptools so that is is inserted424# into the ExternalPackage.subclasses list before them.425class SetuptoolsPackage(ExternalPackage):426 """setuptools package"""427 # For all known setuptools releases a string compare works for the428 # version string. Hopefully they never release a 0.10. (Their own429 # version comparison code would break if they did.)430 # Any system with setuptools > 18.0.1 is fine. If none installed, then431 # try to install the latest found on the upstream.432 minimum_version = '18.0.1'433 version = '18.0.1'434 urls = ('http://pypi.python.org/packages/source/s/setuptools/'435 'setuptools-%s.tar.gz' % (version,),)436 local_filename = 'setuptools-%s.tar.gz' % version437 hex_sum = 'ebc4fe81b7f6d61d923d9519f589903824044f52'438 SUDO_SLEEP_DELAY = 15439 def _build_and_install(self, install_dir):440 """Install setuptools on the system."""441 logging.info('NOTE: setuptools install does not use install_dir.')442 return self._build_and_install_from_package(install_dir)443 def _build_and_install_current_dir(self, install_dir):444 egg_path = self._build_egg_using_setup_py()445 if not egg_path:446 return False447 print '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n'448 print 'About to run sudo to install setuptools', self.version449 print 'on your system for use by', sys.executable, '\n'450 print '!! ^C within', self.SUDO_SLEEP_DELAY, 'seconds to abort.\n'451 time.sleep(self.SUDO_SLEEP_DELAY)452 # Copy the egg to the local filesystem /var/tmp so that root can453 # access it properly (avoid NFS squashroot issues).454 temp_dir = self._get_temp_dir()455 try:456 shutil.copy(egg_path, temp_dir)457 egg_name = os.path.split(egg_path)[1]458 temp_egg = os.path.join(temp_dir, egg_name)459 p = subprocess.Popen(['sudo', '/bin/sh', temp_egg],460 stdout=subprocess.PIPE)461 regex = re.compile('Copying (.*?) to (.*?)\n')462 match = regex.search(p.communicate()[0])463 status = p.wait()464 if match:465 compiled = os.path.join(match.group(2), match.group(1))466 os.system("sudo chmod a+r '%s'" % compiled)467 finally:468 shutil.rmtree(temp_dir)469 if status:470 logging.error('install of setuptools from egg failed.')471 return False472 return True473class MySQLdbPackage(ExternalPackage):474 """mysql package, used in scheduler."""475 module_name = 'MySQLdb'476 version = '1.2.3'477 urls = ('http://downloads.sourceforge.net/project/mysql-python/'478 'mysql-python/%(version)s/MySQL-python-%(version)s.tar.gz'479 % dict(version=version),)480 local_filename = 'MySQL-python-%s.tar.gz' % version481 hex_sum = '3511bb8c57c6016eeafa531d5c3ea4b548915e3c'482 _build_and_install_current_dir = (483 ExternalPackage._build_and_install_current_dir_setup_py)484 def _build_and_install(self, install_dir):485 if not os.path.exists('/usr/bin/mysql_config'):486 error_msg = ('You need to install /usr/bin/mysql_config.\n'487 'On Ubuntu or Debian based systems use this: '488 'sudo apt-get install libmysqlclient15-dev')489 logging.error(error_msg)490 return False, error_msg491 return self._build_and_install_from_package(install_dir)492class DjangoPackage(ExternalPackage):493 """django package."""494 version = '1.5.1'495 local_filename = 'Django-%s.tar.gz' % version496 urls = ('http://www.djangoproject.com/download/%s/tarball/' % version,)497 hex_sum = '0ab97b90c4c79636e56337f426f1e875faccbba1'498 _build_and_install = ExternalPackage._build_and_install_from_package499 _build_and_install_current_dir = (500 ExternalPackage._build_and_install_current_dir_noegg)501 def _get_installed_version_from_module(self, module):502 try:503 return module.get_version().split()[0]504 except AttributeError:505 return '0.9.6'506class NumpyPackage(ExternalPackage):507 """numpy package, required by matploglib."""508 version = '1.7.0'509 local_filename = 'numpy-%s.tar.gz' % version510 urls = ('http://downloads.sourceforge.net/project/numpy/NumPy/%(version)s/'511 'numpy-%(version)s.tar.gz' % dict(version=version),)512 hex_sum = 'ba328985f20390b0f969a5be2a6e1141d5752cf9'513 _build_and_install = ExternalPackage._build_and_install_from_package514 _build_and_install_current_dir = (515 ExternalPackage._build_and_install_current_dir_setupegg_py)516class MatplotlibPackage(ExternalPackage):517 """518 matplotlib package519 This requires numpy so it must be declared after numpy to guarantee that520 it is already installed.521 """522 version = '0.98.5.3'523 short_version = '0.98.5'524 local_filename = 'matplotlib-%s.tar.gz' % version525 urls = ('http://downloads.sourceforge.net/project/matplotlib/matplotlib/'526 'matplotlib-%s/matplotlib-%s.tar.gz' % (short_version, version),)527 hex_sum = '2f6c894cf407192b3b60351bcc6468c0385d47b6'528 os_requirements = {('/usr/include/freetype2/ft2build.h',529 '/usr/include/ft2build.h'): 'libfreetype6-dev',530 ('/usr/include/png.h'): 'libpng12-dev'}531 _build_and_install = ExternalPackage._build_and_install_from_package532 _build_and_install_current_dir = (533 ExternalPackage._build_and_install_current_dir_setupegg_py)534class AtForkPackage(ExternalPackage):535 """atfork package"""536 version = '0.1.2'537 local_filename = 'atfork-%s.zip' % version538 urls = ('http://python-atfork.googlecode.com/files/' + local_filename,)539 hex_sum = '5baa64c73e966b57fa797040585c760c502dc70b'540 _build_and_install = ExternalPackage._build_and_install_from_package541 _build_and_install_current_dir = (542 ExternalPackage._build_and_install_current_dir_noegg)543class ParamikoPackage(ExternalPackage):544 """paramiko package"""545 version = '1.7.5'546 local_filename = 'paramiko-%s.zip' % version547 urls = ('https://pypi.python.org/packages/source/p/paramiko/' + local_filename,)548 hex_sum = 'd23e437c0d8bd6aeb181d9990a9d670fb30d0c72'549 _build_and_install = ExternalPackage._build_and_install_from_package550 def _check_for_pycrypto(self):551 # NOTE(gps): Linux distros have better python-crypto packages than we552 # can easily get today via a wget due to the library's age and staleness553 # yet many security and behavior bugs are fixed by patches that distros554 # already apply. PyCrypto has a new active maintainer in 2009. Once a555 # new release is made (http://pycrypto.org/) we should add an installer.556 try:557 import Crypto558 except ImportError:559 logging.error('Please run "sudo apt-get install python-crypto" '560 'or your Linux distro\'s equivalent.')561 return False562 return True563 def _build_and_install_current_dir(self, install_dir):564 if not self._check_for_pycrypto():565 return False566 # paramiko 1.7.4 doesn't require building, it is just a module directory567 # that we can rsync into place directly.568 if not os.path.isdir('paramiko'):569 raise Error('no paramiko directory in %s.' % os.getcwd())570 status = system("rsync -r 'paramiko' '%s/'" % install_dir)571 if status:572 logging.error('%s rsync to install_dir failed.', self.name)573 return False574 return True575class RequestsPackage(ExternalPackage):576 """requests package"""577 version = '0.11.2'578 local_filename = 'requests-%s.tar.gz' % version579 urls = ('http://pypi.python.org/packages/source/r/requests/' +580 local_filename,)581 hex_sum = '00a49e8bd6dd8955acf6f6269d1b85f50c70b712'582 _build_and_install = ExternalPackage._build_and_install_from_package583 _build_and_install_current_dir = (584 ExternalPackage._build_and_install_current_dir_setup_py)585class JsonRPCLib(ExternalPackage):586 """jsonrpclib package"""587 version = '0.1.3'588 module_name = 'jsonrpclib'589 local_filename = '%s-%s.tar.gz' % (module_name, version)590 urls = ('http://pypi.python.org/packages/source/j/%s/%s' %591 (module_name, local_filename), )592 hex_sum = '431714ed19ab677f641ce5d678a6a95016f5c452'593 def _get_installed_version_from_module(self, module):594 # jsonrpclib doesn't contain a proper version595 return self.version596 _build_and_install = ExternalPackage._build_and_install_from_package597 _build_and_install_current_dir = (598 ExternalPackage._build_and_install_current_dir_noegg)599class Httplib2Package(ExternalPackage):600 """httplib2 package"""601 version = '0.6.0'602 local_filename = 'httplib2-%s.tar.gz' % version603 urls = ('http://httplib2.googlecode.com/files/' + local_filename,)604 hex_sum = '995344b2704826cc0d61a266e995b328d92445a5'605 def _get_installed_version_from_module(self, module):606 # httplib2 doesn't contain a proper version607 return self.version608 _build_and_install = ExternalPackage._build_and_install_from_package609 _build_and_install_current_dir = (610 ExternalPackage._build_and_install_current_dir_noegg)611class GwtPackage(ExternalPackage):612 """Fetch and extract a local copy of GWT used to build the frontend."""613 version = '2.3.0'614 local_filename = 'gwt-%s.zip' % version615 urls = ('http://google-web-toolkit.googlecode.com/files/' + local_filename,)616 hex_sum = 'd51fce9166e6b31349659ffca89baf93e39bc84b'617 name = 'gwt'618 about_filename = 'about.txt'619 module_name = None # Not a Python module.620 def is_needed(self, install_dir):621 gwt_dir = os.path.join(install_dir, self.name)622 about_file = os.path.join(install_dir, self.name, self.about_filename)623 if not os.path.exists(gwt_dir) or not os.path.exists(about_file):624 logging.info('gwt not installed for autotest')625 return True626 f = open(about_file, 'r')627 version_line = f.readline()628 f.close()629 match = re.match(r'Google Web Toolkit (.*)', version_line)630 if not match:631 logging.info('did not find gwt version')632 return True633 logging.info('found gwt version %s', match.group(1))634 return match.group(1) != self.version635 def _build_and_install(self, install_dir):636 os.chdir(install_dir)637 self._extract_compressed_package()638 extracted_dir = self.local_filename[:-len('.zip')]639 target_dir = os.path.join(install_dir, self.name)640 if os.path.exists(target_dir):641 shutil.rmtree(target_dir)642 os.rename(extracted_dir, target_dir)643 return True644class GVizAPIPackage(ExternalPackage):645 """gviz package"""646 module_name = 'gviz_api'647 version = '1.7.0'648 url_filename = 'gviz_api_py-%s.tar.gz' % version649 local_filename = 'google-visualization-python.tar.gz'650 urls = ('http://google-visualization-python.googlecode.com/files/%s' % (651 url_filename),)652 hex_sum = 'cd9a0fb4ca5c4f86c0d85756f501fd54ccf492d2'653 _build_and_install = ExternalPackage._build_and_install_from_package654 _build_and_install_current_dir = (655 ExternalPackage._build_and_install_current_dir_noegg)656 def _get_installed_version_from_module(self, module):657 # gviz doesn't contain a proper version658 return self.version659class StatsdPackage(ExternalPackage):660 """python-statsd package"""661 version = '1.7.2'662 url_filename = 'python-statsd-%s.tar.gz' % version663 local_filename = url_filename664 urls = ('http://pypi.python.org/packages/source/p/python-statsd/%s' % (665 url_filename),)666 hex_sum = '2cc186ebdb723e2420b432ab71639786d877694b'667 _build_and_install = ExternalPackage._build_and_install_from_package668 _build_and_install_current_dir = (669 ExternalPackage._build_and_install_current_dir_setup_py)670class GdataPackage(ExternalPackage):671 """672 Pulls the GData library, giving us an API to query tracker.673 """674 version = '2.0.14'675 url_filename = 'gdata-%s.tar.gz' % version676 local_filename = url_filename677 urls = ('http://gdata-python-client.googlecode.com/files/%s' % (678 url_filename),)679 hex_sum = '5eed0e01ab931e3f706ec544fc8f06ecac384e91'680 _build_and_install = ExternalPackage._build_and_install_from_package681 _build_and_install_current_dir = (682 ExternalPackage._build_and_install_current_dir_noegg)683 def _get_installed_version_from_module(self, module):684 # gdata doesn't contain a proper version685 return self.version686class GoogleAPIClientPackage(ExternalPackage):687 """688 Pulls the Python Google API client library.689 """690 version = '1.1'691 module_name = 'apiclient'692 url_filename = 'google-api-python-client-%s.tar.gz' % version693 local_filename = url_filename694 urls = ('https://google-api-python-client.googlecode.com/files/%s' % (695 url_filename),)696 hex_sum = '2294949683e367b3d4ecaeb77502509c5af21e60'697 _build_and_install = ExternalPackage._build_and_install_from_package698 _build_and_install_current_dir = (699 ExternalPackage._build_and_install_current_dir_setup_py)700class GFlagsPackage(ExternalPackage):701 """702 Gets the Python GFlags client library.703 """704 # gflags doesn't contain a proper version705 version = '2.0'706 url_filename = 'python-gflags-%s.tar.gz' % version707 local_filename = url_filename708 urls = ('https://python-gflags.googlecode.com/files/%s' % (709 url_filename),)710 hex_sum = 'db309e6964b102ff36de319ce551db512a78281e'711 _build_and_install = ExternalPackage._build_and_install_from_package712 _build_and_install_current_dir = (713 ExternalPackage._build_and_install_current_dir_setup_py)714 def _get_installed_version_from_module(self, module):715 return self.version716class DnsPythonPackage(ExternalPackage):717 """718 dns module719 Used in unittests.720 """721 module_name = 'dns'722 version = '1.3.5'723 url_filename = 'dnspython-%s.tar.gz' % version724 local_filename = url_filename725 urls = ('http://www.dnspython.org/kits/%s/%s' % (726 version, url_filename),)727 hex_sum = '06314dad339549613435470c6add992910e26e5d'728 _build_and_install = ExternalPackage._build_and_install_from_package729 _build_and_install_current_dir = (730 ExternalPackage._build_and_install_current_dir_noegg)731 def _get_installed_version_from_module(self, module):732 """Ask our module its version string and return it or '' if unknown."""733 try:734 __import__(self.module_name + '.version')735 return module.version.version736 except AttributeError:737 logging.error('could not get version from %s', module)738 return ''739class PyudevPackage(ExternalPackage):740 """741 pyudev module742 Used in unittests.743 """744 version = '0.16.1'745 url_filename = 'pyudev-%s.tar.gz' % version746 local_filename = url_filename747 urls = ('http://pypi.python.org/packages/source/p/pyudev/%s' % (748 url_filename),)749 hex_sum = 'b36bc5c553ce9b56d32a5e45063a2c88156771c0'750 _build_and_install = ExternalPackage._build_and_install_from_package751 _build_and_install_current_dir = (752 ExternalPackage._build_and_install_current_dir_setup_py)753class PyMoxPackage(ExternalPackage):754 """755 mox module756 Used in unittests.757 """758 module_name = 'mox'759 version = '0.5.3'760 url_filename = 'mox-%s.tar.gz' % version761 local_filename = url_filename762 urls = ('http://pypi.python.org/packages/source/m/mox/%s' % (763 url_filename),)764 hex_sum = '1c502d2c0a8aefbba2c7f385a83d33e7d822452a'765 _build_and_install = ExternalPackage._build_and_install_from_package766 _build_and_install_current_dir = (767 ExternalPackage._build_and_install_current_dir_noegg)768 def _get_installed_version_from_module(self, module):769 # mox doesn't contain a proper version770 return self.version771class PySeleniumPackage(ExternalPackage):772 """773 selenium module774 Used in wifi_interop suite.775 """776 module_name = 'selenium'777 version = '2.37.2'778 url_filename = 'selenium-%s.tar.gz' % version779 local_filename = url_filename780 urls = ('https://pypi.python.org/packages/source/s/selenium/%s' % (781 url_filename),)782 hex_sum = '66946d5349e36d946daaad625c83c30c11609e36'...

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 autotest 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