Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 from __future__ import print_function
00038
00039 import subprocess
00040
00041 cmd = "find . -type f ! -name '*.svn-base' -a ! -name '*.hg' -a ! -name '*.git' -a " \
00042 "\( -name '*.c*' -o -name '*.h*' \)"
00043
00044 header_mappings = {
00045 'class_loader/class_loader.h': 'class_loader/class_loader.hpp',
00046 'class_loader/class_loader_core.h': 'class_loader/class_loader_core.hpp',
00047 'class_loader/class_loader_exceptions.h': 'class_loader/exceptions.hpp',
00048 'class_loader/class_loader_register_macro.h': 'class_loader/register_macro.hpp',
00049 'class_loader/meta_object.h': 'class_loader/meta_object.hpp',
00050 'class_loader/multi_library_class_loader.h': 'class_loader/multi_library_class_loader.hpp',
00051 'class_loader/console_bridge_compatibility.h': 'class_loader/console_bridge_compatibility.hpp',
00052 }
00053 include_tokens = {
00054 '"': '"',
00055 '<': '>',
00056 }
00057 include_prefix = '#include '
00058 sed_cmd_prefix = ' -exec sed -i \' s'
00059 sed_cmd_suffix = ' {} \; '
00060 sed_separator = '@'
00061 full_cmd = cmd
00062 for old_header, new_header in header_mappings.iteritems():
00063 for leading_token, ending_token in include_tokens.iteritems():
00064 full_cmd += \
00065 sed_cmd_prefix + sed_separator + \
00066 include_prefix + leading_token + old_header + ending_token + sed_separator + \
00067 include_prefix + leading_token + new_header + ending_token + sed_separator + \
00068 "g'" + sed_cmd_suffix
00069 print("Looking for '%s' to replace with '%s'" % (old_header, new_header))
00070
00071 print('Running %s' % full_cmd)
00072 ret_code = subprocess.call(full_cmd, shell=True)
00073 if ret_code == 0:
00074 print('success')
00075 else:
00076 print('failure')