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