1#!/usr/bin/python -B
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
13from __future__ import print_function
14
15import os
16import codecs
17
18tree = os.walk(".")
19
20nots=0
21notutf8=0
22noprops=0
23utf8=0
24fixed=0
25tfiles=0
26bom=codecs.BOM_UTF8
27
28
29for ent in tree:
30    (path,dirs,files) = ent
31    if(path.find("/.svn") != -1):
32        continue
33    for file in files:
34        tfiles=tfiles+1
35        fp = (path + "/" + file)
36        if not os.path.isfile(fp):
37            continue
38        f = open(fp, 'rb')
39        bytes=f.read(3)
40        if bytes and (bytes == bom):
41            print('icu/'+fp[2::])
42        f.close()
43