summaryrefslogtreecommitdiffstats
path: root/usr/share
diff options
context:
space:
mode:
authorPapoteur <papoteur@mageia.org>2018-10-27 07:27:06 +0200
committerPapoteur <papoteur@mageia.org>2018-10-27 07:27:06 +0200
commit840927499528cd706a323f5844162724e936fa58 (patch)
tree696dfedd330b789ec64ebd52b169bebd59afb5b0 /usr/share
parentc238ee93d2cdca363e2a9408f2c54500e9d5d176 (diff)
downloadmageiawelcome-840927499528cd706a323f5844162724e936fa58.tar
mageiawelcome-840927499528cd706a323f5844162724e936fa58.tar.gz
mageiawelcome-840927499528cd706a323f5844162724e936fa58.tar.bz2
mageiawelcome-840927499528cd706a323f5844162724e936fa58.tar.xz
mageiawelcome-840927499528cd706a323f5844162724e936fa58.zip
Manage installed packages with distinction of repo tainted , nonfree or core
Use rpm bindings instead of shells
Diffstat (limited to 'usr/share')
-rw-r--r--usr/share/mageiawelcome/helpers.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/usr/share/mageiawelcome/helpers.py b/usr/share/mageiawelcome/helpers.py
index 9caf8b1..d94f352 100644
--- a/usr/share/mageiawelcome/helpers.py
+++ b/usr/share/mageiawelcome/helpers.py
@@ -4,12 +4,15 @@
import csv
import os
import gettext
+import rpm
gettext.install("mageiawelcome")
install = _("Install")
launch = _("Launch")
+ts = rpm.TransactionSet()
+
def get_desktop_name(x):
return {
'01plasma':'KDE',
@@ -38,7 +41,17 @@ def get_desktop_name2(x):
def is_installed(name):
- return os.WEXITSTATUS(os.system('rpm -q --quiet ' + name))
+ mi = ts.dbMatch('name', name)
+ release = ""
+ for h in mi:
+ release = (h['release']).decode("utf-8")
+ if release.endswith("tainted"):
+ repo = 'tainted'
+ elif release.endswith("nonfree"):
+ repo = 'nonfree'
+ else:
+ repo = 'core'
+ return release != "", repo
def get_listapp():
@@ -55,7 +68,8 @@ def get_listapp():
label = "<span class='label red'>" + r[6] + "</span>"
else:
label = ""
- if ( is_installed(r[1]) != 0):# NOT INSTALLED
+ is_app_installed, repo = is_installed(r[1])
+ if ( not is_app_installed or repo != r[6]):# NOT INSTALLED
listapp += "<li class='" + r[3] +"' id='" + r[0] + "'><img class=icon src=img/" + r[0] + ".png /><div class='chkbox'><input type='checkbox' datasrc='" + r[1] +"'></div> \
<h6>" + r[2] + "</h6><p class='description'>" + r[4] + "</p>" + label + "<button class='inst small' data-rpm='" + r[1] + "'><i class='icon-circle-arrow-down'> </i>" + install +"</button></li>"
else: # INSTALLED