summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Drung <bdrung@debian.org>2012-04-22 00:49:04 +0200
committerBenjamin Drung <bdrung@debian.org>2012-04-22 00:49:04 +0200
commitc9a34d68d39b0f10b5b4ca234f72e41d8201ddf9 (patch)
tree69ca7ebb642dfd737f6be953699282f2432bc31b
parent30718474aaf9bba929dfeaddca7478043f51022b (diff)
install-xpi: Fail nicely if debian/control is missing.
-rwxr-xr-xinstall-xpi14
1 files changed, 14 insertions, 0 deletions
diff --git a/install-xpi b/install-xpi
index 17915f1..eec71c0 100755
--- a/install-xpi
+++ b/install-xpi
@@ -37,6 +37,18 @@ LICENSE_PATTERN_LIST = (
COMMAND_LINE_SYNTAX_ERROR = 1
XPI_FILE_DOES_NOT_EXISTS = 2
+def check_package_directory(script_name):
+ """Check if the debian/ directory and files like debian/control exist."""
+ if not os.path.isdir("debian"):
+ sys.stderr.write(script_name + ": Error: Failed to find debian/ "
+ "directory. Please execute the script in a Debian "
+ "source package.\n")
+ sys.exit(1)
+ if not os.path.isfile("debian/control"):
+ sys.stderr.write(script_name + ": Error: debian/control file is "
+ "missing.\n")
+ sys.exit(1)
+
def get_query_field_id_as_list(rdf_path, query_string):
ret = []
model = RDF.Model()
@@ -244,6 +256,8 @@ def main():
(script_name, ", ".join(args))
sys.exit(COMMAND_LINE_SYNTAX_ERROR)
+ check_package_directory(script_name)
+
if options.package is None:
options.package = get_first_package()