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
13import os
14import codecs
15
16tree = os.walk(".")
17
18nots=0
19notutf8=0
20noprops=0
21utf8=0
22fixed=0
23tfiles=0
24bom=codecs.BOM_UTF8
25
26
27for 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