diff options
author | Alexander Sack <asac@ubuntu.com> | 2009-12-16 04:09:28 +0100 |
---|---|---|
committer | Alexander Sack <asac@ubuntu.com> | 2009-12-16 04:09:28 +0100 |
commit | 2aced5031d1cbf3c26cb53438a4f6e5460dec199 (patch) | |
tree | 0ae99faab6d133196ba7244f2e2f597ca8cfa09f /src/dh_xul-ext | |
parent | 2664bca2f6b30f0f96178f69981418b48a7314b4 (diff) |
[ Alexander Sack <asac@ubuntu.com> ]
* dh_xul-ext:
- convert xpath expression to python/rdflib; extract (id, max, min)
triples for all targetApplications in get_supported_apps; in turn
add python-rdflib to Depends
- update src/dh_xul-ext
- update debian/control
Diffstat (limited to 'src/dh_xul-ext')
-rwxr-xr-x | src/dh_xul-ext | 32 |
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 |