3 """Utilities submodule"""
6 from __future__ import print_function
14 def call_program(args):
15 ''' Calls program with specified parameters
16 and returns the stdout as a str object.
18 @param, args: arument list to pass to subprocess
21 subp = subprocess.Popen(args, stdout=subprocess.PIPE, \
22 stderr=subprocess.PIPE)
23 stdout, stderr = subp.communicate()
27 def scan(params, files, max_args):
28 ''' Calls scanelf with given params and files to scan.
29 @param params is list of parameters that should
30 be passed into scanelf app.
31 @param files list of files to scan.
32 @param max_args number of files to process at once
34 When files count is greater CMD_MAX_ARGS, it'll be divided
37 @return scanelf output (joined if was called several times)
40 for i in range(0, len(files), max_args):
42 ['scanelf'] + params + files[i:i+max_args]).strip().split('\n')
46 def get_masking_status(ebuild):
47 """returns the masking status of an ebuild
53 status = portage.getmaskingstatus(ebuild)
55 status = ['unavailable']
59 def _match_str_in_list(lst, stri):
63 @return boolean or list menber that matches stri.endswith(member)
66 if stri.endswith(item):
72 if __name__ == '__main__':
73 print("There is nothing to run here.")