1 #!/usr/bin/python 2 3 # Copyright (C) 2016 and later: Unicode, Inc. and others. 4 # License & terms of use: http://www.unicode.org/copyright.html 5 # Copyright (C) 2011 IBM Corporation and Others. All Rights Reserved. 6 # 7 # run in icu/ 8 # will create file icu/as_is/bomlist.txt 9 # 10 # Usage: 11 # ( python as_is/bomlist.py > as_is/bomlist.txt ) || rm -f as_is/bomlist.txt 12 13 import os 14 import codecs 15 16 tree = os.walk(".") 17 18 nots=0 19 notutf8=0 20 noprops=0 21 utf8=0 22 fixed=0 23 tfiles=0 24 bom=codecs.BOM_UTF8 25 26 27 for ent in tree: 28 (path,dirs,files) = ent 29 if(path.find("/.svn") != -1): 30 continue 31 for file in files: 32 tfiles=tfiles+1 33 fp = (path + "/" + file) 34 if not os.path.isfile(fp): 35 continue 36 f = open(fp, 'rb') 37 bytes=f.read(3) 38 if bytes and (bytes == bom): 39 print 'icu/'+fp[2::] 40 f.close() 41