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 import sys
00034 import os
00035
00036 def generate_setup_bat_text():
00037
00038 text = """
00039 REM This is a file auto-generated by rosinstall for windows
00040 REM refer to http://www.ros.org/wiki/win_rosinstall
00041 REM for more information.
00042 """
00043 home_drive = os.environ['HOMEDRIVE']
00044 program_files = home_drive + r'\Program Files'
00045 program_files_x86 = home_drive + r'\Program Files (x86)'
00046 windows_sdk_env = program_files + r'\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd';
00047 visual_studio_ten_env = program_files + r'\Microsoft Visual Studio 10.0\VC\vcvarsall.bat';
00048 visual_studio_ten_env_x86 = program_files_x86 + r'\Microsoft Visual Studio 10.0\VC\vcvarsall.bat';
00049 wordpad_path = program_files + r'\Windows NT\Accessories\wordpad.exe';
00050 wordpad_path_x86 = program_files_x86 + r'\Windows NT\Accessories\wordpad.exe';
00051 notepp_path = program_files + r'\Notepad++\notepad++.exe';
00052 notepp_path_x86 = program_files_x86 + r'\Notepad++\notepad++.exe';
00053
00054 text += "\n"
00055 text += "@REM Utility variables\n"
00056 if os.path.isfile(wordpad_path):
00057 text += '@doskey wordpad="'+wordpad_path+'" $1\n'
00058 else:
00059 text += '@doskey wordpad="'+wordpad_path_x86+'" $1\n'
00060 if os.path.isfile(notepp_path):
00061 text += '@doskey notepp="'+notepp_path+'" $1\n'
00062 elif os.path.isfile(notepp_path_x86):
00063 text += '@doskey notepp="'+notepp_path_x86+'" $1\n'
00064 else:
00065 text += '@REM doskey notepp="'+notepp_path+'" $1\n'
00066 text += "\n"
00067 if os.path.isfile(windows_sdk_env):
00068 text += "@REM Environment settings for Windows SDK\n"
00069 text += '@call "' + windows_sdk_env + '" /x86 /Release\n'
00070 text += "@REM The sdk is the default generator for winros,\n"
00071 text += "@REM To use visual studio, uncomment one of the following.\n"
00072 text += '@REM "' + visual_studio_ten_env + '" x86\n'
00073 text += '@REM "' + visual_studio_ten_env_x86 + '" x86\n'
00074 elif os.path.isfile(visual_studio_ten_env):
00075 text += "@REM Environment settings for Visual Studio\n"
00076 text += '@call "' + visual_studio_ten_env + '" x86\n'
00077 text += '@REM call "' + windows_sdk_env + '" /x86 /Release\n'
00078 elif os.path.isfile(visual_studio_ten_env_x86):
00079 text += "@REM Environment settings for Visual Studio\n"
00080 text += '@call "' + visual_studio_ten_env_x86 + '" x86\n'
00081 text += '@REM call "' + windows_sdk_env + '" /x86 /Release\n'
00082 else:
00083 text += "@REM Could not find windows sdk or visual studio, please\n"
00084 text += "@REM install and configure by hand [Windows SDK/Visual Studio]\n"
00085 text += '@REM call "' + windows_sdk_env + '" /x86 /Release\n'
00086 text += '@REM "' + visual_studio_ten_env + '" x86\n'
00087 text += '@REM "' + visual_studio_ten_env_x86 + '" x86\n'
00088 text += '@REM Colours are a god awful ugly canary yellow or vomit green\n'
00089 text += '@color 7\n'
00090 text += "\n"
00091 return text
00092
00093 if __name__ == "__main__":
00094 from optparse import OptionParser
00095 parser = OptionParser()
00096 (unused_options, args) = parser.parse_args()
00097 base_path = args[0]
00098 text = generate_setup_bat_text()
00099 setup_path = os.path.join(base_path, 'setup.bat')
00100 with open(setup_path, 'w') as f:
00101 f.write(text)