def _install(self, pkg):
# to have a unified string which we can query
# we need to execute the command with LANG=en_US.UTF-8
cmd = 'LANG=en_US.UTF-8 yaourt --needed --noconfirm -S {}'.format(pkg)
self._log.info("Installing \"{}\". Please wait...".format(pkg))
# needed to avoid conflicts due to locking
time.sleep(1)
proc = subprocess.Popen(cmd, shell=True,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
out = proc.stdout.read()
proc.stdout.close()
for item in self._strings.keys():
if out.decode("utf-8").find(self._strings[item]) >= 0:
return item
self._log.warning("Could not determine what happened with package {}".format(pkg))
return PkgStatus.NOT_SURE
评论列表
文章目录