summaryrefslogtreecommitdiffstats
path: root/usr/share/mageiawelcome/helpers.py
diff options
context:
space:
mode:
Diffstat (limited to 'usr/share/mageiawelcome/helpers.py')
-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