Hi,

The attached script changes the license URL in the source tree. The script reports 4922 files need changing.

Please let me know if you have any issue with the change or you spot any problems.

There will need to be some clean up in the doc directory.

Chris
#
# Script to replace wwww.rtems.com with www.rtems.org.
#
# Chris Johns <chr...@rtems.org>
#
# usage:
#  $ git clone git://git.rtems.org/rtems.git
#  $ cd rtems
#  $ python ../com-to-org.py
#
# To undo:
#  $ git reset --hard
#

import os

def change(path, from_, to_):
    matching = {}
    for root, dirs, files in os.walk(path, followlinks = True):
        for f in files:
            name = os.path.join(root, f)
            fh = open(name, 'r')
            body = fh.readlines()
            fh.close()
            body = ''.join(body)
            if body.find(from_) >= 0:
                matching[name] = body.replace(from_, to_)
    return matching

matched = change('.', 'www.rtems.com', 'www.rtems.org')
total = len(matched)
total_size = len('%d' % (total))
print 'Total: %d' % (total)
count = 0
for name in sorted(matched):
    count += 1
    print '[%*d/%d] %s' % (total_size, count, total, name)
    fh = open(name, 'w')
    fh.write(matched[name])
    fh.close()
_______________________________________________
rtems-devel mailing list
rtems-devel@rtems.org
http://www.rtems.org/mailman/listinfo/rtems-devel

Reply via email to