summaryrefslogtreecommitdiff
path: root/src/dh_xul-ext
diff options
context:
space:
mode:
Diffstat (limited to 'src/dh_xul-ext')
-rwxr-xr-xsrc/dh_xul-ext32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/dh_xul-ext b/src/dh_xul-ext
index 15177dc..e9c4276 100755
--- a/src/dh_xul-ext
+++ b/src/dh_xul-ext
@@ -26,6 +26,9 @@ import os
import subprocess
import sys
+from rdflib import Namespace
+from rdflib.Graph import Graph
+
# error codes
COMMAND_LINE_SYNTAX_ERROR = 1
MULTIPLE_INSTALL_RDFs = 2
@@ -68,13 +71,28 @@ def get_xul_apps():
return sorted(packages)
def get_supported_apps(xul_apps, install_rdf, package):
- # TODO
-## data for XPI_RECOMMENDS/CHECK_VERSION magic - targetApplication min-/maxVersions
-## call parameters_
-## 1- target app id
-## 2- maxVersion | minVersion
-#TARGET_VERSION = $(shell xpath -q -e '//em:targetApplication/Description[em:id="$(1)" or @em:id="$(1)"]/em:$(2)/text() | //em:targetApplication/Description[em:id="$(1)" or @em:id="$(1)"]/@em:$(2) | //RDF:Description[@em:id="$(1)"]/em:$(2)/text() | //RDF:Description[@em:id="$(1)"]/@em:$(2)' $(install_dir)/install.rdf | sed -e 's/.*"\(.*\)"/\1/')
-
+ # create array of id_max_min triples
+ id_max_min = []
+ rdf_graph = Graph()
+ rdf_graph.parse(install_rdf)
+ results = rdf_graph.query(
+ """
+ SELECT ?id ?max ?min
+ WHERE {
+ ?x1 em:targetApplication ?x2 .
+ ?x2 em:id ?id .
+ OPTIONAL {
+ ?x2 em:maxVersion ?max .
+ ?x2 em:minVersion ?min .
+ } .
+ }
+ """, initNs=dict(em=Namespace("http://www.mozilla.org/2004/em-rdf#")))
+
+ # append to id_max_min tripe to array
+ for target in results:
+ id_max_min.append (( str(target[0]), str(target[1]), str (target[2]) ))
+
+# TODO - figure out apps etc.
## call parameters_
## 1- target app id
## 2- package name