merge_cmake_install.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # file: merge_cmake_install.py
00003 
00004 import sys, math
00005 import fnmatch
00006 import os
00007 import shutil
00008 
00009 if len(sys.argv) != 2: 
00010   # stop the program and print an error message
00011   sys.exit("Must provide a cmake binary folder")
00012 
00013 base_folder = sys.argv[1]
00014 
00015 string_to_remove_debug = "IF(\"${CMAKE_INSTALL_CONFIG_NAME}\" MATCHES \"^([Dd][Ee][Bb][Uu][Gg])$\")"
00016 string_to_remove_release = "IF(\"${CMAKE_INSTALL_CONFIG_NAME}\" MATCHES \"^([Rr][Ee][Ll][Ee][Aa][Ss][Ee])$\")"
00017 
00018 matches = []
00019 for root, dirnames, filenames in os.walk(base_folder):
00020   for filename in fnmatch.filter(filenames, 'cmake_install.cmake'):
00021       matches.append(os.path.join(root, filename))
00022           
00023 for one_match in matches:
00024         #print one_match, "\n"
00025         shutil.move( one_match, one_match+"~" )
00026         destination= open( one_match, "w" )
00027         source= open( one_match+"~", "r" )
00028         for line in source:
00029                 if string_to_remove_debug in line:
00030                         destination.write( "\n" )
00031                 elif string_to_remove_release in line:
00032                         destination.write( "\n" )
00033                 else:
00034                         destination.write( line )
00035         source.close()
00036         destination.close()


pcl
Author(s): Open Perception
autogenerated on Mon Oct 6 2014 03:15:39