diff options
-rwxr-xr-x | src/dh_xul-ext | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/src/dh_xul-ext b/src/dh_xul-ext index 0e71651..6a61bd4 100755 --- a/src/dh_xul-ext +++ b/src/dh_xul-ext @@ -57,7 +57,8 @@ class XulApp(object): def get_versioned_package(self): versioned_package = self.package if self.min_version: - versioned_package += " (>= " + convert_moz_to_debian_version(self.min_version) + ")" + deb_min_version = convert_moz_to_debian_version(self.min_version) + versioned_package += " (>= " + deb_min_version + ")" return versioned_package def set_max_version(self, max_version): @@ -78,7 +79,8 @@ def get_xul_apps(): xul_apps.append(xul_app) return xul_apps -def get_supported_apps(script_name, xul_apps, install_rdf, package, verbose=False): +def get_supported_apps(script_name, xul_apps, install_rdf, package, + verbose=False): # create array of id_max_min triples id_max_min = [] model = RDF.Model() @@ -105,7 +107,8 @@ def get_supported_apps(script_name, xul_apps, install_rdf, package, verbose=Fals target["min"].literal_value["string"])) if verbose: - print "%s: %s supports %i XUL application(s):" % (script_name, package, len(id_max_min)) + print "%s: %s supports %i XUL application(s):" % (script_name, package, + len(id_max_min)) for (appid, max_version, min_version) in id_max_min: print "%s %s to %s" % (appid, min_version, max_version) @@ -122,14 +125,18 @@ def get_supported_apps(script_name, xul_apps, install_rdf, package, verbose=Fals xul_app.set_max_version(max_version) supported_apps.append(xul_app) if verbose: - print "%s: %s supports %s." % (script_name, package, xul_app.get_package()) + print "%s: %s supports %s." % (script_name, package, + xul_app.get_package()) elif verbose: - print "%s: %s does not support %s (any more)." % (script_name, package, xul_app.get_package()) + print "%s: %s does not support %s (any more)." % \ + (script_name, package, xul_app.get_package()) elif verbose: - print "%s: %s does not support %s (yet)." % (script_name, package, xul_app.get_package()) + print "%s: %s does not support %s (yet)." % \ + (script_name, package, xul_app.get_package()) elif len(supported_app) > 1: - print "%s: Found error in %s. There are multiple entries for application ID %s." % \ - (script_name, install_rdf, xul_app.get_id()) + print ("%s: Found error in %s. There are multiple entries for " + "application ID %s.") % (script_name, install_rdf, + xul_app.get_id()) return supported_apps @@ -189,7 +196,8 @@ def find_install_rdfs(path): if os.path.isdir(path): # recursive walk content = map(lambda d: os.path.join(path, d), os.listdir(path)) - install_rdfs = reduce(lambda x, d: x.union(find_install_rdfs(d)), content, install_rdfs) + install_rdfs = reduce(lambda x, d: x.union(find_install_rdfs(d)), + content, install_rdfs) return install_rdfs @@ -199,7 +207,11 @@ def generate_substvars(script_name, xul_apps, package, verbose=False): # this package does not contain a xul extension return elif len(install_rdfs) > 1: - print >> sys.stderr, "%s: %s contains multiple install.rdf files. That's not supported." % (script_name, package) + print >> sys.stderr, ("%s: %s contains multiple install.rdf files. " + "That's not supported.") % (script_name, package) + basepath_len = len(os.path.realpath("debian/" + package)) + rdfs = map(lambda x: x[basepath_len:], install_rdfs) + print >> sys.stderr, "\n".join(rdfs) sys.exit(MULTIPLE_INSTALL_RDFs) install_rdf = install_rdfs.pop() @@ -214,7 +226,8 @@ def generate_substvars(script_name, xul_apps, package, verbose=False): # remove existing varibles lines = filter(lambda s: not s.startswith("xpi:"), lines) - supported_apps = get_supported_apps(script_name, xul_apps, install_rdf, package, verbose) + supported_apps = get_supported_apps(script_name, xul_apps, install_rdf, + package, verbose) packages = map(lambda a: a.get_package(), supported_apps) lines.append("xpi:Recommends=" + " | ".join(packages) + "\n") lines.append("xpi:Enhances=" + ", ".join(sorted(packages)) + "\n") @@ -266,7 +279,8 @@ if __name__ == "__main__": if options.verbose: for unknown_option in parser.unknown_options: - sys.stderr.write("%s: warning: no such option: %s\n" % (script_name, unknown_option)) + sys.stderr.write("%s: warning: no such option: %s\n" % \ + (script_name, unknown_option)) print script_name + ": packages:", ", ".join(options.packages) xul_apps = get_xul_apps() |