summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog9
-rw-r--r--debian/control2
-rwxr-xr-xsrc/dh_xul-ext17
-rwxr-xr-xsrc/install-xpi33
4 files changed, 36 insertions, 25 deletions
diff --git a/debian/changelog b/debian/changelog
index 87bbf76..f739bd6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+mozilla-devscripts (0.23) UNRELEASED; urgency=low
+
+ * Switch from python-rdflib to python-librdf; thanks to Willi Mann for the
+ patch.
+ - update src/dh_xul-ext
+ - update src/install-xpi
+
+ -- Benjamin Drung <bdrung@ubuntu.com> Thu, 10 Jun 2010 13:48:39 +0200
+
mozilla-devscripts (0.22) unstable; urgency=low
* Add a dh buildsystem; thanks to Mike Hommey for the patch (Closes: #576946).
diff --git a/debian/control b/debian/control
index 94bd24b..2e028ca 100644
--- a/debian/control
+++ b/debian/control
@@ -18,7 +18,7 @@ Package: mozilla-devscripts
Architecture: all
Depends: dpkg-dev,
fakeroot,
- python-rdflib,
+ python-librdf,
quilt,
unzip,
wget,
diff --git a/src/dh_xul-ext b/src/dh_xul-ext
index 3592663..8447e01 100755
--- a/src/dh_xul-ext
+++ b/src/dh_xul-ext
@@ -29,8 +29,7 @@ import sys
from moz_version import compare_versions
-from rdflib import Namespace
-from rdflib.Graph import Graph
+import RDF
# error codes
COMMAND_LINE_SYNTAX_ERROR = 1
@@ -47,10 +46,12 @@ def get_xul_apps():
def get_supported_apps(script_name, xul_apps, install_rdf, package, verbose=False):
# create array of id_max_min triples
id_max_min = []
- rdf_graph = Graph()
- rdf_graph.parse(install_rdf)
- results = rdf_graph.query(
+ model = RDF.Model()
+ parser = RDF.Parser(name="rdfxml")
+ stream = parser.parse_into_model(model, "file:" + install_rdf)
+ query = RDF.Query(
"""
+ PREFIX em: <http://www.mozilla.org/2004/em-rdf#>
SELECT ?id ?max ?min
WHERE {
?x1 em:targetApplication ?x2 .
@@ -60,11 +61,11 @@ def get_supported_apps(script_name, xul_apps, install_rdf, package, verbose=Fals
?x2 em:minVersion ?min .
} .
}
- """, initNs=dict(em=Namespace("http://www.mozilla.org/2004/em-rdf#")))
-
+ """, query_language="sparql")
+ results = query.execute(model)
# 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]) ))
+ id_max_min.append (( str(target["id"]), str(target["max"]), str (target["min"]) ))
if verbose:
print "%s: %s supports %i XUL application(s):" % (script_name, package, len(id_max_min))
diff --git a/src/install-xpi b/src/install-xpi
index 61771e9..3d657ad 100755
--- a/src/install-xpi
+++ b/src/install-xpi
@@ -28,31 +28,32 @@ import subprocess
import sys
import zipfile
-from rdflib import Namespace
-from rdflib.Graph import Graph
+import RDF
# error codes
COMMAND_LINE_SYNTAX_ERROR = 1
XPI_FILE_DOES_NOT_EXISTS = 2
+def get_query_field_id_as_list(rdf_path, query_string):
+ ret = []
+ model = RDF.Model()
+ parser = RDF.Parser(name="rdfxml")
+ stream = parser.parse_into_model(model, "file:" + rdf_path)
+ query = RDF.Query("PREFIX em: <http://www.mozilla.org/2004/em-rdf#> " + query_string, query_language="sparql")
+ results = query.execute(model)
+ for result in results:
+ ret.append(str(result["id"]))
+ return ret
+
+
def get_target_applications(script_name, install_rdf, verbose=False):
- target_applications = []
- rdf_graph = Graph()
- rdf_graph.parse(install_rdf)
- query = "SELECT ?id WHERE { ?x1 em:targetApplication ?x2 . ?x2 em:id ?id }"
- results = rdf_graph.query(query, initNs=dict(em=Namespace("http://www.mozilla.org/2004/em-rdf#")))
- for target in results:
- target_applications.append(str(target[0]))
+ target_applications = get_query_field_id_as_list(install_rdf,
+ "SELECT ?id WHERE { ?x1 em:targetApplication ?x2 . ?x2 em:id ?id }")
return target_applications
def get_extension_id(install_rdf):
- extension_ids = set()
- rdf_graph = Graph()
- rdf_graph.parse(install_rdf)
- query = "SELECT ?id WHERE {?x1 em:targetApplication ?x2 . ?x1 em:id ?id }"
- results = rdf_graph.query(query, initNs=dict(em=Namespace("http://www.mozilla.org/2004/em-rdf#")))
- for result in results:
- extension_ids.add(str(result[0]))
+ extension_ids = set(get_query_field_id_as_list(install_rdf,
+ "SELECT ?id WHERE {?x1 em:targetApplication ?x2 . ?x1 em:id ?id }"))
return extension_ids.pop()
def get_arch(package):