summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenjamin Drung <bdrung@ubuntu.com>2011-07-16 18:52:18 +0200
committerBenjamin Drung <bdrung@ubuntu.com>2011-07-16 18:52:18 +0200
commit715d764a4a9b8ac2f1dd8d626d100bb21cbdb9f6 (patch)
tree332031a791ca43f5c1c194013c355f3331ed8d8a /src
parentf99e1341db9979e7edad31c14a769173e4dc1f9c (diff)
Add a DH_XUL_EXT_VENDOR environment variable to dh_xul-ext.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/dh_xul-ext28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/dh_xul-ext b/src/dh_xul-ext
index 26bc0d5..3abaa8c 100755
--- a/src/dh_xul-ext
+++ b/src/dh_xul-ext
@@ -25,6 +25,7 @@ from moz_version import compare_versions, convert_moz_to_debian_version
import RDF
+_VENDOR_ENV = "DH_XUL_EXT_VENDOR"
# error codes
COMMAND_LINE_SYNTAX_ERROR = 1
MULTIPLE_INSTALL_RDFS = 2
@@ -87,15 +88,30 @@ def _get_data_dir():
data_dir = os.path.dirname(__file__)
return data_dir
-def get_xul_apps(all_distros):
- data_dir = _get_data_dir()
- if all_distros:
- csv_filenames = glob.glob(os.path.join(data_dir, "xul-app-data.csv.*"))
+def get_vendor():
+ """This function returns the vendor (e.g. Debian, Ubuntu) that should be
+ used for calculating the dependencies. DH_XUL_EXT_VENDOR will be used
+ if set. Otherwise dpkg-vendor will be used for determining the vendor."""
+ if _VENDOR_ENV in os.environ:
+ vendor = os.environ[_VENDOR_ENV]
else:
cmd = ["dpkg-vendor", "--query", "Vendor"]
process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
vendor = process.communicate()[0].strip()
- csv_filenames = [os.path.join(data_dir, "xul-app-data.csv." + vendor)]
+ return vendor
+
+def get_xul_apps(script_name, all_distros):
+ vendor = get_vendor()
+ data_dir = _get_data_dir()
+ if all_distros or vendor == "all":
+ csv_filenames = glob.glob(os.path.join(data_dir, "xul-app-data.csv.*"))
+ else:
+ csv_filename = os.path.join(data_dir, "xul-app-data.csv." + vendor)
+ if not os.path.isfile(csv_filename):
+ print >> sys.stderr, ('%s: Unknown vendor "%s" specified.' %
+ (script_name, vendor))
+ sys.exit(1)
+ csv_filenames = [csv_filename]
xul_apps = []
for csv_filename in csv_filenames:
@@ -337,7 +353,7 @@ def main():
(script_name, unknown_option))
print script_name + ": packages:", ", ".join(options.packages)
- xul_apps = get_xul_apps(options.all)
+ xul_apps = get_xul_apps(script_name, options.all)
if options.verbose and len(xul_apps) > 0:
print script_name + ": found %i Xul applications:" % (len(xul_apps))
for xul_app in xul_apps: