mirror of
https://github.com/Snigdha-OS/snigdhaos-blackbox.git
synced 2025-09-21 20:15:02 +02:00
extend function #1
This commit is contained in:

committed by
GitHub

parent
51c1feb99e
commit
18f90f1791
@@ -1174,4 +1174,31 @@ def get_package_information(package_name):
|
|||||||
return "error: package '%s' not found!\n" % package_name
|
return "error: package '%s' not found!\n" % package_name
|
||||||
else:
|
else:
|
||||||
|
|
||||||
|
# NOTE : ICON ON THE BACK
|
||||||
|
def get_current_installed():
|
||||||
|
logger.debug(
|
||||||
|
"Get currently installed packages"
|
||||||
|
)
|
||||||
|
path = base_dir + "/cache/installed.lst"
|
||||||
|
|
||||||
|
query_str = [
|
||||||
|
"pacman",
|
||||||
|
"-Q",
|
||||||
|
]
|
||||||
|
|
||||||
|
subprocess_query = subprocess.Popen(
|
||||||
|
query_str,
|
||||||
|
shell=False,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
)
|
||||||
|
|
||||||
|
out, err = subprocess_query.communicate(timeout=process_timeout)
|
||||||
|
|
||||||
|
# added validation on process result
|
||||||
|
if subprocess_query.returncode == 0:
|
||||||
|
file = open(path, "w")
|
||||||
|
for line in out.decode("utf-8"):
|
||||||
|
file.write(line)
|
||||||
|
file.close()
|
||||||
|
else:
|
||||||
|
logger.warning("Failed to run %s" % query_str)
|
Reference in New Issue
Block a user