Changeset 3125 for pjproject/trunk/tests/automated/configure.py
- Timestamp:
- Mar 27, 2010 7:49:18 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/tests/automated/configure.py
r3122 r3125 12 12 build_type = "" 13 13 vs_target = "" 14 s60_target = "" 14 15 15 16 # … … 31 32 32 33 # 33 # Get Visual Studio version34 # Get Visual Studio info 34 35 # 35 36 class VSVersion: … … 75 76 76 77 78 # 79 # Get S60 SDK info 80 # 81 class S60SDK: 82 def __init__(self): 83 # Check that EPOCROOT is set 84 if not "EPOCROOT" in os.environ: 85 print "Error: EPOCROOT environment variable is not set" 86 sys.exit(1) 87 epocroot = os.environ["EPOCROOT"] 88 # EPOCROOT must have trailing backslash 89 if epocroot[-1] != "\\": 90 epocroot = epocroot + "\\" 91 os.environ["EPOCROOT"] = epocroot 92 sdk1 = epocroot.split("\\")[-2] 93 94 # Check that correct device is set 95 proc = subprocess.Popen("devices", stdout=subprocess.PIPE, 96 stderr=subprocess.STDOUT, shell=True) 97 sdk2 = "" 98 while True: 99 line = proc.stdout.readline() 100 if line.find("- default") > 0: 101 sdk2 = line.split(":",1)[0] 102 break 103 proc.wait() 104 105 if sdk1 != sdk2: 106 print "Error: default SDK in device doesn't match EPOCROOT" 107 print "Default device SDK =", sdk2 108 print "EPOCROOT SDK =", sdk1 109 sys.exit(1) 110 111 self.name = sdk2.replace("_", "-") 112 113 114 77 115 def replace_vars(text): 78 global vs_target, build_type116 global vs_target, s60_target, build_type 79 117 suffix = "" 118 80 119 os_info = platform.system() + platform.release() + "-" + platform.machine() 81 120 82 121 # osinfo 83 if platform.system().lower() == "windows" or platform.system().lower() == "microsoft": 122 if build_type == "s60": 123 os_info = S60SDK().name 124 elif platform.system().lower() == "windows" or platform.system().lower() == "microsoft": 84 125 if platform.system().lower() == "microsoft": 85 126 os_info = platform.release() + "-" + platform.version() + "-" + platform.win32_ver()[2] … … 87 128 os_info = + "-" + "-".join(platform.linux_distribution()[0:2]) 88 129 89 # Buildvs_target130 # vs_target 90 131 if not vs_target and text.find("$(VSTARGET)") >= 0: 91 132 if build_type != "vs": 92 sys.stderr.write("Error: $(VSTARGET) only valid for Visual Studio\n") 93 sys.exit(1) 94 else: 95 print "Enter Visual Studio vs_target name (e.g. Release, Debug) [Release]: ", 96 vs_target = sys.stdin.readline().replace("\n", "").replace("\r", "") 97 if not vs_target: 98 vs_target = "Release" 99 133 sys.stderr.write("Warning: $(VSTARGET) only valid for Visual Studio\n") 134 print "Enter Visual Studio vs_target name (e.g. Release, Debug) [Release]: ", 135 vs_target = sys.stdin.readline().replace("\n", "").replace("\r", "") 136 if not vs_target: 137 vs_target = "Release" 138 139 # s60_target 140 if not s60_target and text.find("$(S60TARGET)") >= 0: 141 if build_type != "s60": 142 sys.stderr.write("Warning: $(S60TARGET) only valid for S60\n") 143 print "Enter S60 target name (e.g. \"gcce urel\") [gcce urel]: ", 144 s60_target = sys.stdin.readline().replace("\n", "").replace("\r", "") 145 if not s60_target: 146 s60_target = "gcce urel" 147 100 148 # Suffix 101 149 if build_type == "vs": 102 150 suffix = "i386-Win32-vc8-" + vs_target 151 elif build_type == "s60": 152 suffix = S60SDK().name + "-" + s60_target.replace(" ", "-") 103 153 elif build_type == "gnu": 104 154 proc = subprocess.Popen("sh config.guess", cwd="../..", … … 122 172 elif text.find("$(VS)") >= 0: 123 173 vsver = VSVersion() 124 text = text.replace("$(VS)", vsver.vs_release)174 text = text.replace("$(VS)", VSVersion().vs_release) 125 175 elif text.find("$(VSTARGET)") >= 0: 126 176 text = text.replace("$(VSTARGET)", vs_target) 177 elif text.find("$(S60TARGET)") >= 0: 178 text = text.replace("$(S60TARGET)", s60_target) 179 elif text.find("$(S60TARGETNAME)") >= 0: 180 text = text.replace("$(S60TARGETNAME)", s60_target.replace(" ", "-")) 127 181 elif text.find("$(DISABLED)") >= 0: 128 182 text = text.replace("$(DISABLED)", "0") … … 143 197 144 198 def main(args): 145 global vs_target, build_type199 global vs_target, s60_target, build_type 146 200 usage = """Usage: configure.py [OPTIONS] scenario_template_file 147 201 148 202 Where OPTIONS: 149 -t TYPE Specify build type for Windows since we support both 150 Visual Studio and Mingw. If not specified, it will be 151 asked if necessary. Values are: 152 vs: Visual Studio 153 gnu: Makefile based 154 -T TARGETNAME Specify Visual Studio target name if build type is set 155 to "vs", e.g. Release or Debug. If not specified then 156 it will be asked. 203 -t TYPE Specify build type for Windows since we support both 204 Visual Studio and Mingw. If not specified, it will be 205 asked if necessary. Values are: 206 vs: Visual Studio 207 gnu: Makefile based 208 s60: Symbian S60 209 -vstarget TARGETNAME Specify Visual Studio target name if build type is set 210 to vs. If not specified then it will be asked. 211 Sample target names: 212 - Debug 213 - Release 214 - or any other target in the project file 215 -s60target TARGETNAME Specify S60 target name if build type is set to s60. 216 If not specified then it will be asked. Sample target 217 names: 218 - "gcce udeb" 219 - "gcce urel" 157 220 """ 158 221 159 222 args.pop(0) 160 223 while len(args): 161 if args[0]=='- T':224 if args[0]=='-vstarget': 162 225 args.pop(0) 163 226 if len(args): … … 165 228 args.pop(0) 166 229 else: 167 sys.stderr.write("Error: needs value for -T\n") 230 sys.stderr.write("Error: needs value for -vstarget\n") 231 sys.exit(1) 232 elif args[0]=='-s60target': 233 args.pop(0) 234 if len(args): 235 s60_target = args[0] 236 args.pop(0) 237 else: 238 sys.stderr.write("Error: needs value for -s60target\n") 168 239 sys.exit(1) 169 240 elif args[0]=='-t': … … 175 246 sys.stderr.write("Error: needs value for -t\n") 176 247 sys.exit(1) 177 if not ["vs", "gnu" ].count(build_type):248 if not ["vs", "gnu", "s60"].count(build_type): 178 249 sys.stderr.write("Error: invalid -t argument value\n") 179 250 sys.exit(1) … … 186 257 187 258 if not build_type and (platform.system().lower() == "windows" or platform.system().lower() == "microsoft"): 188 print "Enter the build type (values: vs, gnu ) [vs]: ",259 print "Enter the build type (values: vs, gnu, s60) [vs]: ", 189 260 build_type = sys.stdin.readline().replace("\n", "").replace("\r", "") 190 261 if not build_type:
Note: See TracChangeset
for help on using the changeset viewer.