How to use get_pkgs method in autotest

Best Python code snippet using autotest_python

sets.py

Source:sets.py Github

copy

Full Screen

...15import portage16from .. import system17from ...helper import debug18class Set(object):19 def get_pkgs(self, key, is_regexp, masked, with_version, only_cpv):20 raise NotImplementedError21 def find (self, key, masked = False, with_version = True, only_cpv = False):22 if key is None: key = ""23 24 is_regexp = key == "" or ("*" in key[1:] and key[0] not in ("=","<",">","~","!"))25 try:26 t = self.get_pkgs(key, is_regexp, masked, with_version, only_cpv)27 # catch the "ambigous package" Exception28 except ValueError as e:29 if isinstance(e[0], list):30 t = set()31 for cp in e[0]:32 t.update(self.get_pkgs(cp, is_regexp, masked, with_version, only_cpv))33 else:34 raise35 return t36class InstalledSet (Set):37 """For the moment do not use the portage-2.2 @installed set.38 It only contains the current slot-cps - and to get the cpvs39 via the PortageSet results in an infinite recursion :(."""40 def _get_regexp (self, key, with_version):41 if with_version:42 t = system.settings.vartree.dbapi.cpv_all()43 else:44 t = system.settings.vartree.dbapi.cp_all()45 if key:46 t = [x for x in t if re.search(key, x, re.I)]...

Full Screen

Full Screen

koji-builds-in-common

Source:koji-builds-in-common Github

copy

Full Screen

...23 Print out builds and packages in common.24 """25 opts = koji.read_config(profile)26 c = koji.ClientSession(opts['server'])27 def get_pkgs(builds):28 return set([b['package_name'] for b in builds])29 def get_blds(builds):30 return set([b['nvr'] for b in builds])31 def printt(msg):32 if not terse:33 print msg34 answers = {}35 answers[tags[0]] = c.listTagged(tags[0], inherit=inherit, latest=latest)36 pcommon = get_pkgs(answers[tags[0]])37 bcommon = get_blds(answers[tags[0]])38 for t in tags[1:]:39 answers[t] = c.listTagged(t, inherit=inherit, latest=latest)40 pcommon.intersection_update(get_pkgs(answers[t]))41 bcommon.intersection_update(get_blds(answers[t]))42 printt('Tags considered: %s' % ', '.join(tags))43 printt('Builds in common:')44 for b in bcommon:45 print b46 print47 printt('Packages in common:')48 for p in pcommon:49 printh = True50 for t in tags:51 nvr = [b['nvr'] for b in answers[t] if b['package_name'] == p][0]52 if nvr in bcommon:53 break54 if printh:...

Full Screen

Full Screen

android_cleaner.py

Source:android_cleaner.py Github

copy

Full Screen

...3def adb(cmd):4 return popen(f"adb shell {cmd}").read()5def adb_rm(pkg):6 return adb(f"pm uninstall -k --user 0 {pkg}")7def get_pkgs(search):8 pkgs = []9 for pk in adb(f"pm list packages | grep -E '{search}'").split("\n"):10 try:11 pkg = pk.split("package:")[1]12 pkgs.append(pkg)13 except IndexError:14 pass15 return pkgs16def rm_pkgs(search):17 for pkg in get_pkgs(search):18 adb_rm(pkg)19def search_pkgs(search):20 print(f"searching for '{search}' gave folowing results:")21 res = get_pkgs(search)22 for r in res:23 print(r)24 print(f"amount of pkgs: {len(res)}")25def rm_and_check(search):26 search_pkgs(search)27 if (in_ := input("remove [y/N]:\n>")) == "y" or in_ == "Y":28 rm_pkgs(search)29 print("removed!")30 else:31 print("deleting aborted!")32 search_pkgs(search)33# rm_and_check("google")34def choose_pkgs(search):35 from sys import path; path.insert(1, '/home/nls/py/cnav')36 from cnav import Nav37 nav = Nav()38 nav.opts["endless_search_mode"] = False39 nav.opts["horizontal_split"] = True40 res = nav.navigate(get_pkgs(search))41 from sys import path; path.insert(1, '/home/nls/py/pytools'); import nls_util as nut42 nut.notify(f"{type(res)}")43 return res[0]44def interactive_rm():45 while True:46 pkgs = choose_pkgs(input("search term: "))47 for pkg in pkgs:48 print(f" - {pkg}")49 if (in_ := input("remve these packages [y/N]: ")) == "y" or in_ == "Y":50 print("removed!")51 for pkg in pkgs:52 adb_rm(pkg)53 else:54 print("aborted!")...

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