[gnome-doc-utils] [xml2po] Don't return 0 when command line contains errors (Bug #413999)
- From: Claude Paroz <claudep src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-doc-utils] [xml2po] Don't return 0 when command line contains errors (Bug #413999)
- Date: Sat, 27 Jun 2009 13:04:59 +0000 (UTC)
commit 46f8008446aa7efb7ae3bd2facc85cab0ca7d354
Author: Claude Paroz <claude 2xlibre net>
Date: Sat Jun 27 14:57:36 2009 +0200
[xml2po] Don't return 0 when command line contains errors (Bug #413999)
xml2po/xml2po.py | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/xml2po/xml2po.py b/xml2po/xml2po.py
index 9ac84cd..5622635 100755
--- a/xml2po/xml2po.py
+++ b/xml2po/xml2po.py
@@ -713,9 +713,9 @@ if not os.path.exists('/dev/null'): NULL_STRING = 'NUL'
import getopt, fileinput
def usage (with_help = False):
- print >> sys.stderr, "Usage: %s [OPTIONS] [XMLFILE]..." % (sys.argv[0])
- if (with_help):
- print >> sys.stderr, """
+ print >> sys.stderr, "Usage: %s [OPTIONS] [XMLFILE]..." % (sys.argv[0])
+ if with_help:
+ print >> sys.stderr, """
OPTIONS may be some of:
-a --automatic-tags Automatically decides if tags are to be considered
"final" or not
@@ -746,15 +746,18 @@ EXAMPLES:
%s -p de.po chapter1.xml > chapter1.de.xml
%s -p de.po chapter2.xml > chapter2.de.xml
""" % (sys.argv[0], sys.argv[0], sys.argv[0])
- sys.exit(0)
-if len(sys.argv) < 2: usage()
+if len(sys.argv) < 2:
+ usage()
+ sys.exit(2)
args = sys.argv[1:]
try: opts, args = getopt.getopt(args, 'avhkem:t:o:p:u:r:l:',
['automatic-tags','version', 'help', 'keep-entities', 'expand-all-entities', 'mode=', 'translation=',
'output=', 'po-file=', 'update-translation=', 'reuse=', 'language=', 'mark-untranslated' ])
-except getopt.GetoptError: usage(True)
+except getopt.GetoptError:
+ usage(True)
+ sys.exit(2)
for opt, arg in opts:
if opt in ('-m', '--mode'):
@@ -789,7 +792,8 @@ for opt, arg in opts:
print VERSION
sys.exit(0)
elif opt in ('-h', '--help'):
- usage(True)
+ usage(True)
+ sys.exit(0)
# Treat remaining arguments as XML files
while args:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]