ICU-10465 improve bldicures

X-SVN-Rev: 35048
This commit is contained in:
Steven R. Loomis 2014-01-31 02:37:57 +00:00
parent 0b5902b94d
commit d8b2004576

View File

@ -1,6 +1,6 @@
#!/usr/bin/python
#
# Copyright (C) 2013 IBM Corporation and Others. All Rights Reserved.
# Copyright (C) 2013-2014 IBM Corporation and Others. All Rights Reserved.
#
print "NOTE: this tool is a TECHNOLOGY PREVIEW and not a supported ICU tool."
#
@ -37,12 +37,14 @@ import sys
import argparse
import os
endian=sys.byteorder
parser = argparse.ArgumentParser(description='Yet Another ICU Resource Builder', epilog='ICU tool, http://icu-project.org - master copy at http://source.icu-project.org/repos/icu/tools/trunk/scripts/bldicures.py')
parser.add_argument('-f', '--from', action='append', dest='fromdirs', help='read .txt files from this dir', metavar='fromdir', required=True)
parser.add_argument('-n', '--name', action='store', help='set the bundle name, such as "myapp"', metavar='bundname', required=True)
parser.add_argument('-m', '--mode', action='store', help='pkgdata mode', metavar='mode', default="archive")
parser.add_argument('-d', '--dest', action='store', dest='destdir', help='dest dir, default is ".".', default=".", metavar='destdir')
parser.add_argument('-e', '--endian', action='store', dest='endian', help='endian, big or little, default is "host".', default="host", metavar='endianness')
parser.add_argument('-e', '--endian', action='store', dest='endian', help='endian, big, little or host, your default is "%s".' % endian, default=endian, metavar='endianness')
parser.add_argument('--verbose', '-v', action='count',default=0)
args = parser.parse_args()
@ -57,15 +59,16 @@ os.makedirs('%s/%s/' % (args.destdir, tmpdir))
listname = '%s/%s/icufiles.lst' % (args.destdir, tmpdir)
if args.endian not in ("big","little","host"):
print "Unknown endianness: %s" % args.endian
sys.exit(1)
if args.endian not in ("big"):
print "Unsupported endianness: %s" % args.endian
sys.exit(1)
if args.endian is "host":
args.endian = endian
needswap = args.endian not in ("host")
needswap = args.endian is not endian
if needswap and args.mode not in ("archive", "files"):
print "Don't know how to do swapping for mode=%s" % args.mode
@ -119,15 +122,11 @@ for dir in args.fromdirs:
if (path.find("/.svn") != -1):
continue
for file in files:
if (file.find(".txt") == -1):
if (file[-4:] != ".txt"):
if args.verbose>1:
print "Ignoring %s/%s" % (path,file)
continue
(loc,ext) = file.split('.')
if ext != "txt":
if args.verbose>1:
print "Ignoring (bad ext %s) %s/%s" % (ext, path,file)
print "Ignoring %s/%s with suffix %s" % (path,file, file[-4:])
continue
loc = file[:-4]
add_loc(path, loc)
print >>idxfn, " }"