summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Drung <bdrung@debian.org>2012-04-22 00:37:49 +0200
committerBenjamin Drung <bdrung@debian.org>2012-04-22 00:37:49 +0200
commit30718474aaf9bba929dfeaddca7478043f51022b (patch)
treeea1086fc704a9feca2ee2f7232303ca5322ba990
parent5822d42d7fa58aa8de40636474d32623c97fafa0 (diff)
install-xpi: Fix crash when invoking --help outside a package directory.
LP: #900689
-rwxr-xr-xinstall-xpi12
1 files changed, 7 insertions, 5 deletions
diff --git a/install-xpi b/install-xpi
index f73b1bf..17915f1 100755
--- a/install-xpi
+++ b/install-xpi
@@ -205,8 +205,9 @@ def get_first_package():
return packages[0]
def main():
- usage = "%s [options] <xpi-file>" % (os.path.basename(sys.argv[0]))
- epilog = "See %s(1) for more info." % (os.path.basename(sys.argv[0]))
+ script_name = os.path.basename(sys.argv[0])
+ usage = "%s [options] <xpi-file>" % (script_name)
+ epilog = "See %s(1) for more info." % (script_name)
parser = optparse.OptionParser(usage=usage, epilog=epilog)
parser.add_option("--disable-system-prefs",
@@ -223,7 +224,7 @@ def main():
dest="links", action="append", default=list())
parser.add_option("-p", "--package", metavar="PACKAGE",
help="install the extension into specified PACKAGE",
- dest="package", default=get_first_package())
+ dest="package", default=None)
parser.add_option("--preserve-permissions",
help="do not adjust the file permissions",
dest="correct_permissions", action="store_false", default=True)
@@ -235,8 +236,6 @@ def main():
(options, args) = parser.parse_args()
- script_name = os.path.basename(sys.argv[0])
-
if len(args) == 0:
print >> sys.stderr, "%s: Error: No xpi file specified." % (script_name)
sys.exit(COMMAND_LINE_SYNTAX_ERROR)
@@ -245,6 +244,9 @@ def main():
(script_name, ", ".join(args))
sys.exit(COMMAND_LINE_SYNTAX_ERROR)
+ if options.package is None:
+ options.package = get_first_package()
+
if options.verbose:
print script_name + ": Install %s into package %s." % \
(args[0], options.package)