- Timestamp:
- 2010-11-02T11:13:36Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4687a26c, e06ef614
- Parents:
- 458619f7
- git-author:
- Vojtech Horky <> (2010-11-02 11:13:36)
- git-committer:
- Martin Decky <martin@…> (2010-11-02 11:13:36)
- Location:
- tools
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/autotool.py
r458619f7 r28f4adb 75 75 "Read HelenOS build configuration" 76 76 77 inf = file(fname, 'r')77 inf = open(fname, 'r') 78 78 79 79 for line in inf: … … 191 191 check_common(common, "CC") 192 192 193 outf = file(PROBE_SOURCE, 'w')193 outf = open(PROBE_SOURCE, 'w') 194 194 outf.write(PROBE_HEAD) 195 195 … … 212 212 if (not os.path.isfile(PROBE_OUTPUT)): 213 213 sys.stderr.write("failed\n") 214 print output[1]214 print(output[1]) 215 215 print_error(["Error executing \"%s\"." % " ".join(args), 216 216 "The compiler did not produce the output file \"%s\"." % PROBE_OUTPUT, … … 221 221 sys.stderr.write("ok\n") 222 222 223 inf = file(PROBE_OUTPUT, 'r')223 inf = open(PROBE_OUTPUT, 'r') 224 224 lines = inf.readlines() 225 225 inf.close() … … 343 343 "Create makefile output" 344 344 345 outmk = file(mkname, 'w')345 outmk = open(mkname, 'w') 346 346 347 347 outmk.write('#########################################\n') … … 357 357 "Create header output" 358 358 359 outhd = file(hdname, 'w')359 outhd = open(hdname, 'w') 360 360 361 361 outhd.write('/***************************************\n') -
tools/checkers/clang.py
r458619f7 r28f4adb 42 42 def usage(prname): 43 43 "Print usage syntax" 44 print prname + " <ROOT>"44 print(prname + " <ROOT>") 45 45 46 46 def clang(root, job): … … 50 50 51 51 if (not os.path.isfile(inname)): 52 print "Unable to open %s" % inname53 print "Did you run \"make precheck\" on the source tree?"52 print("Unable to open %s" % inname) 53 print("Did you run \"make precheck\" on the source tree?") 54 54 return False 55 55 56 inf = file(inname, "r")56 inf = open(inname, "r") 57 57 records = inf.read().splitlines() 58 58 inf.close() … … 64 64 65 65 if (len(arg) < 6): 66 print "Not enought jobfile record arguments"66 print("Not enought jobfile record arguments") 67 67 return False 68 68 … … 76 76 srcfqname = os.path.join(base, srcfname) 77 77 if (not os.path.isfile(srcfqname)): 78 print "Source %s not found" % srcfqname78 print("Source %s not found" % srcfqname) 79 79 return False 80 80 … … 108 108 109 109 if (not os.path.isfile(config)): 110 print "%s not found." % config111 print "Please specify the path to HelenOS build tree root as the first argument."110 print("%s not found." % config) 111 print("Please specify the path to HelenOS build tree root as the first argument.") 112 112 return 113 113 … … 115 115 if (not clang(rootdir, job)): 116 116 print 117 print "Failed job: %s" % job117 print("Failed job: %s" % job) 118 118 return 119 119 120 120 print 121 print "All jobs passed"121 print("All jobs passed") 122 122 123 123 if __name__ == '__main__': -
tools/checkers/jobfile.py
r458619f7 r28f4adb 54 54 nil = True 55 55 else: 56 print "Unexpected '%s'" % record[i]56 print("Unexpected '%s'" % record[i]) 57 57 return False 58 58 -
tools/checkers/stanse.py
r458619f7 r28f4adb 43 43 def usage(prname): 44 44 "Print usage syntax" 45 print prname + " <ROOT>"45 print(prname + " <ROOT>") 46 46 47 47 def stanse(root, job): … … 54 54 55 55 if (not os.path.isfile(inname)): 56 print "Unable to open %s" % inname57 print "Did you run \"make precheck\" on the source tree?"56 print("Unable to open %s" % inname) 57 print("Did you run \"make precheck\" on the source tree?") 58 58 return False 59 59 60 inf = file(inname, "r")60 inf = open(inname, "r") 61 61 records = inf.read().splitlines() 62 62 inf.close() … … 69 69 70 70 if (len(arg) < 6): 71 print "Not enought jobfile record arguments"71 print("Not enought jobfile record arguments") 72 72 return False 73 73 … … 81 81 srcfqname = os.path.join(base, srcfname) 82 82 if (not os.path.isfile(srcfqname)): 83 print "Source %s not found" % srcfqname83 print("Source %s not found" % srcfqname) 84 84 return False 85 85 … … 90 90 output.append([srcfname, tgtfname, base, options]) 91 91 92 outf = file(outname, "w")92 outf = open(outname, "w") 93 93 for record in output: 94 94 outf.write("{%s},{%s},{%s},{%s}\n" % (record[0], record[1], record[2], record[3])) … … 121 121 122 122 if (not os.path.isfile(config)): 123 print "%s not found." % config124 print "Please specify the path to HelenOS build tree root as the first argument."123 print("%s not found." % config) 124 print("Please specify the path to HelenOS build tree root as the first argument.") 125 125 return 126 126 … … 128 128 if (not stanse(rootdir, job)): 129 129 print 130 print "Failed job: %s" % job130 print("Failed job: %s" % job) 131 131 return 132 132 133 133 print 134 print "All jobs passed"134 print("All jobs passed") 135 135 136 136 if __name__ == '__main__': -
tools/checkers/vcc.py
r458619f7 r28f4adb 49 49 def usage(prname): 50 50 "Print usage syntax" 51 print prname + " <ROOT> [VCC_PATH]"51 print(prname + " <ROOT> [VCC_PATH]") 52 52 53 53 def cygpath(upath): … … 72 72 preproc = subprocess.Popen(args, stdout = subprocess.PIPE).communicate()[0] 73 73 74 tmpf = file(tmpfname, "w")74 tmpf = open(tmpfname, "w") 75 75 tmpf.write(specification) 76 76 … … 108 108 109 109 if (not os.path.isfile(inname)): 110 print "Unable to open %s" % inname111 print "Did you run \"make precheck\" on the source tree?"110 print("Unable to open %s" % inname) 111 print("Did you run \"make precheck\" on the source tree?") 112 112 return False 113 113 114 inf = file(inname, "r")114 inf = open(inname, "r") 115 115 records = inf.read().splitlines() 116 116 inf.close() … … 122 122 123 123 if (len(arg) < 6): 124 print "Not enought jobfile record arguments"124 print("Not enought jobfile record arguments") 125 125 return False 126 126 … … 134 134 srcfqname = os.path.join(base, srcfname) 135 135 if (not os.path.isfile(srcfqname)): 136 print "Source %s not found" % srcfqname136 print("Source %s not found" % srcfqname) 137 137 return False 138 138 … … 153 153 154 154 # Run Vcc 155 print " -- %s --" % srcfname155 print(" -- %s --" % srcfname) 156 156 retval = subprocess.Popen([vcc_path, '/pointersize:32', '/newsyntax', cygpath(tmpfqname)]).wait() 157 157 … … 182 182 183 183 if (not os.path.isfile(vcc_path)): 184 print "%s is not a binary." % vcc_path185 print "Please supply the full Cygwin path to Vcc as the second argument."184 print("%s is not a binary." % vcc_path) 185 print("Please supply the full Cygwin path to Vcc as the second argument.") 186 186 return 187 187 … … 189 189 190 190 if (not os.path.isfile(config)): 191 print "%s not found." % config192 print "Please specify the path to HelenOS build tree root as the first argument."191 print("%s not found." % config) 192 print("Please specify the path to HelenOS build tree root as the first argument.") 193 193 return 194 194 195 195 specpath = os.path.join(rootdir, "tools/checkers/vcc.h") 196 196 if (not os.path.isfile(specpath)): 197 print "%s not found." % config197 print("%s not found." % config) 198 198 return 199 199 … … 205 205 if (not vcc(vcc_path, rootdir, job)): 206 206 print 207 print "Failed job: %s" % job207 print("Failed job: %s" % job) 208 208 return 209 209 210 210 print 211 print "All jobs passed"211 print("All jobs passed") 212 212 213 213 if __name__ == '__main__': -
tools/config.py
r458619f7 r28f4adb 48 48 "Read saved values from last configuration run" 49 49 50 inf = file(fname, 'r')50 inf = open(fname, 'r') 51 51 52 52 for line in inf: … … 103 103 condval = res.group(3) 104 104 105 if (not defaults.has_key(condname)):105 if (not condname in defaults): 106 106 varval = '' 107 107 else: … … 131 131 "Parse configuration file" 132 132 133 inf = file(fname, 'r')133 inf = open(fname, 'r') 134 134 135 135 name = '' … … 219 219 continue 220 220 221 if (not defaults.has_key(varname)):221 if (not varname in defaults): 222 222 return False 223 223 … … 232 232 233 233 try: 234 version = subprocess.Popen(['bzr', 'version-info', '--custom', '--template={clean}:{revno}:{revision_id}'], stdout = subprocess.PIPE).communicate()[0]. split(':')234 version = subprocess.Popen(['bzr', 'version-info', '--custom', '--template={clean}:{revno}:{revision_id}'], stdout = subprocess.PIPE).communicate()[0].decode().split(':') 235 235 sys.stderr.write("ok\n") 236 236 except: … … 246 246 revision = None 247 247 248 outmk = file(mkname, 'w')249 outmc = file(mcname, 'w')248 outmk = open(mkname, 'w') 249 outmc = open(mcname, 'w') 250 250 251 251 outmk.write('#########################################\n') … … 263 263 continue 264 264 265 if (not defaults.has_key(varname)):265 if (not varname in defaults): 266 266 default = '' 267 267 else: … … 368 368 # Cancel out all defaults which have to be deduced 369 369 for varname, vartype, name, choices, cond in ask_names: 370 if ((vartype == 'y') and ( defaults.has_key(varname)) and (defaults[varname] == '*')):370 if ((vartype == 'y') and (varname in defaults) and (defaults[varname] == '*')): 371 371 defaults[varname] = None 372 372 … … 385 385 position = cnt 386 386 387 if (not defaults.has_key(varname)):387 if (not varname in defaults): 388 388 default = None 389 389 else: … … 428 428 cnt += 1 429 429 430 if (position >= options):430 if (position != None) and (position >= len(options)): 431 431 position = None 432 432 … … 449 449 450 450 position = None 451 if (not opt2row.has_key(value)):451 if (not value in opt2row): 452 452 raise RuntimeError("Error selecting value: %s" % value) 453 453 454 454 (selname, seltype, name, choices) = opt2row[value] 455 455 456 if (not defaults.has_key(selname)):456 if (not selname in defaults): 457 457 default = None 458 458 else: -
tools/jobfile.py
r458619f7 r28f4adb 38 38 def usage(prname): 39 39 "Print usage syntax" 40 print prname + " <JOBFILE> <SOURCE> <TARGET> <TOOL> <CATEGORY> [OPTIONS ...]"40 print(prname + " <JOBFILE> <SOURCE> <TARGET> <TOOL> <CATEGORY> [OPTIONS ...]") 41 41 42 42 def main(): … … 53 53 options = " ".join(sys.argv[6:]) 54 54 55 jobfile = file(jobfname, "a")55 jobfile = open(jobfname, "a") 56 56 fcntl.lockf(jobfile, fcntl.LOCK_EX) 57 57 jobfile.write("{%s},{%s},{%s},{%s},{%s},{%s}\n" % (srcfname, tgtfname, toolname, category, cwd, options)) -
tools/mkfat.py
r458619f7 r28f4adb 46 46 return size 47 47 48 return (( (size / alignment) + 1) * alignment)48 return ((size // alignment) + 1) * alignment 49 49 50 50 def subtree_size(root, cluster_size, dirent_size): … … 79 79 first = 0 80 80 81 inf = file(path, "r")81 inf = open(path, "rb") 82 82 rd = 0; 83 83 while (rd < size): … … 92 92 prev = empty_cluster 93 93 94 data = inf.read(cluster_size);94 data = bytes(inf.read(cluster_size)); 95 95 outf.seek(data_start + (empty_cluster - reserved_clusters) * cluster_size) 96 96 outf.write(data) … … 120 120 prev = empty_cluster 121 121 122 data = ''122 data = bytes() 123 123 data_len = 0 124 124 while ((i < length) and (data_len < cluster_size)): … … 343 343 def usage(prname): 344 344 "Print usage syntax" 345 print prname + " <EXTRA_BYTES> <PATH> <IMAGE>"345 print(prname + " <EXTRA_BYTES> <PATH> <IMAGE>") 346 346 347 347 def main(): … … 351 351 352 352 if (not sys.argv[1].isdigit()): 353 print "<EXTRA_BYTES> must be a number"353 print("<EXTRA_BYTES> must be a number") 354 354 return 355 355 … … 358 358 path = os.path.abspath(sys.argv[2]) 359 359 if (not os.path.isdir(path)): 360 print "<PATH> must be a directory"360 print("<PATH> must be a directory") 361 361 return 362 362 … … 372 372 # Make sure the filesystem is large enought for FAT16 373 373 size = subtree_size(path, cluster_size, dirent_size) + reserved_clusters * cluster_size + extra_bytes 374 while (size / cluster_size < fat16_clusters):374 while (size // cluster_size < fat16_clusters): 375 375 if (cluster_size > sector_size): 376 cluster_size /=2376 cluster_size = cluster_size // 2 377 377 size = subtree_size(path, cluster_size, dirent_size) + reserved_clusters * cluster_size + extra_bytes 378 378 else: … … 381 381 root_size = align_up(root_entries(path) * dirent_size, cluster_size) 382 382 383 fat_size = align_up(align_up(size, cluster_size) / cluster_size * fatent_size, sector_size)384 385 sectors = (cluster_size + fat_count * fat_size + root_size + size) / sector_size383 fat_size = align_up(align_up(size, cluster_size) // cluster_size * fatent_size, sector_size) 384 385 sectors = (cluster_size + fat_count * fat_size + root_size + size) // sector_size 386 386 root_start = cluster_size + fat_count * fat_size 387 387 data_start = root_start + root_size 388 388 389 outf = file(sys.argv[3], "w")389 outf = open(sys.argv[3], "wb") 390 390 391 391 boot_sector = xstruct.create(BOOT_SECTOR) 392 392 boot_sector.jmp = [0xEB, 0x3C, 0x90] 393 boot_sector.oem = "MSDOS5.0"393 boot_sector.oem = b'MSDOS5.0' 394 394 boot_sector.sector = sector_size 395 boot_sector.cluster = cluster_size / sector_size396 boot_sector.reserved = cluster_size / sector_size395 boot_sector.cluster = cluster_size // sector_size 396 boot_sector.reserved = cluster_size // sector_size 397 397 boot_sector.fats = fat_count 398 boot_sector.rootdir = root_size / dirent_size398 boot_sector.rootdir = root_size // dirent_size 399 399 if (sectors <= 65535): 400 400 boot_sector.sectors = sectors … … 402 402 boot_sector.sectors = 0 403 403 boot_sector.descriptor = 0xF8 404 boot_sector.fat_sectors = fat_size / sector_size404 boot_sector.fat_sectors = fat_size // sector_size 405 405 boot_sector.track_sectors = 63 406 406 boot_sector.heads = 6 … … 414 414 boot_sector.extboot_signature = 0x29 415 415 boot_sector.serial = random.randint(0, 0x7fffffff) 416 boot_sector.label = "HELENOS"417 boot_sector.fstype = "FAT16 "416 boot_sector.label = b'HELENOS' 417 boot_sector.fstype = b'FAT16 ' 418 418 boot_sector.boot_signature = [0x55, 0xAA] 419 419 … … 423 423 424 424 # Reserved sectors 425 for i in range(1, cluster_size / sector_size):425 for i in range(1, cluster_size // sector_size): 426 426 outf.write(empty_sector.pack()) 427 427 428 428 # FAT tables 429 429 for i in range(0, fat_count): 430 for j in range(0, fat_size / sector_size):430 for j in range(0, fat_size // sector_size): 431 431 outf.write(empty_sector.pack()) 432 432 433 433 # Root directory 434 for i in range(0, root_size / sector_size):434 for i in range(0, root_size // sector_size): 435 435 outf.write(empty_sector.pack()) 436 436 437 437 # Data 438 for i in range(0, size / sector_size):438 for i in range(0, size // sector_size): 439 439 outf.write(empty_sector.pack()) 440 440 441 fat = array.array('L', [0] * (fat_size / fatent_size))441 fat = array.array('L', [0] * (fat_size // fatent_size)) 442 442 fat[0] = 0xfff8 443 443 fat[1] = 0xffff … … 449 449 for i in range(0, fat_count): 450 450 outf.seek(cluster_size + i * fat_size) 451 for j in range(0, fat_size / fatent_size):451 for j in range(0, fat_size // fatent_size): 452 452 fat_entry.next = fat[j] 453 453 outf.write(fat_entry.pack()) -
tools/mkhord.py
r458619f7 r28f4adb 52 52 def usage(prname): 53 53 "Print usage syntax" 54 print prname + " <ALIGNMENT> <FS_IMAGE> <HORD_IMAGE>"54 print(prname + " <ALIGNMENT> <FS_IMAGE> <HORD_IMAGE>") 55 55 56 56 def main(): … … 60 60 61 61 if (not sys.argv[1].isdigit()): 62 print "<ALIGNMENT> must be a number"62 print("<ALIGNMENT> must be a number") 63 63 return 64 64 65 65 align = int(sys.argv[1], 0) 66 66 if (align <= 0): 67 print "<ALIGNMENT> must be positive"67 print("<ALIGNMENT> must be positive") 68 68 return 69 69 70 70 fs_image = os.path.abspath(sys.argv[2]) 71 71 if (not os.path.isfile(fs_image)): 72 print "<FS_IMAGE> must be a file"72 print("<FS_IMAGE> must be a file") 73 73 return 74 74 75 inf = file(fs_image, "rb")76 outf = file(sys.argv[3], "wb")75 inf = open(fs_image, "rb") 76 outf = open(sys.argv[3], "wb") 77 77 78 78 header = xstruct.create(HEADER) -
tools/mktmpfs.py
r458619f7 r28f4adb 66 66 def usage(prname): 67 67 "Print usage syntax" 68 print prname + " <PATH> <IMAGE>"68 print(prname + " <PATH> <IMAGE>") 69 69 70 70 def recursion(root, outf): … … 85 85 outf.write(dentry.pack()) 86 86 87 inf = file(canon, "r")87 inf = open(canon, "rb") 88 88 rd = 0; 89 89 while (rd < size): … … 116 116 path = os.path.abspath(sys.argv[1]) 117 117 if (not os.path.isdir(path)): 118 print "<PATH> must be a directory"118 print("<PATH> must be a directory") 119 119 return 120 120 121 outf = file(sys.argv[2], "w")121 outf = open(sys.argv[2], "wb") 122 122 123 123 header = xstruct.create(HEADER) -
tools/mkuimage.py
r458619f7 r28f4adb 72 72 start_addr = (int)(optarg, 0) 73 73 else: 74 print base_name + ": Unrecognized option."74 print(base_name + ": Unrecognized option.") 75 75 print_syntax(cmd_name) 76 76 return 77 77 78 78 if len(args) < 2: 79 print base_name + ": Argument missing."79 print(base_name + ": Argument missing.") 80 80 print_syntax(cmd_name) 81 81 return … … 91 91 92 92 def mkuimage(inf_name, outf_name, image_name, load_addr, start_addr): 93 inf = file(inf_name, 'rb')94 outf = file(outf_name, 'wb')93 inf = open(inf_name, 'rb') 94 outf = open(outf_name, 'wb') 95 95 96 96 header = xstruct.create(UIMAGE_HEADER) … … 140 140 signed_crc = zlib.crc32(byteseq, 0) 141 141 if signed_crc < 0: 142 return (long(signed_crc) + 4294967296L) # 2^32L142 return (long(signed_crc) + (long(2) ** long(32))) # 2^32L 143 143 else: 144 144 return signed_crc … … 147 147 # 148 148 def print_syntax(cmd): 149 print "syntax: " + cmd + " [<options>] <raw_image> <uImage>"149 print("syntax: " + cmd + " [<options>] <raw_image> <uImage>") 150 150 print 151 print "\traw_image\tInput image name (raw binary data)"152 print "\tuImage\t\tOutput uImage name (U-Boot image)"151 print("\traw_image\tInput image name (raw binary data)") 152 print("\tuImage\t\tOutput uImage name (U-Boot image)") 153 153 print 154 print "options:"155 print "\t-name <name>\tImage name (default: 'Noname')"156 print "\t-laddr <name>\tLoad address (default: 0x00000000)"157 print "\t-saddr <name>\tStart address (default: 0x00000000)"154 print("options:") 155 print("\t-name <name>\tImage name (default: 'Noname')") 156 print("\t-laddr <name>\tLoad address (default: 0x00000000)") 157 print("\t-saddr <name>\tStart address (default: 0x00000000)") 158 158 159 159 if __name__ == '__main__': -
tools/pack.py
r458619f7 r28f4adb 43 43 def usage(prname): 44 44 "Print usage syntax" 45 print "%s <OBJCOPY> <FORMAT> <ARCH> <ARCH_PATH> [COMPONENTS ...]" % prname45 print("%s <OBJCOPY> <FORMAT> <ARCH> <ARCH_PATH> [COMPONENTS ...]" % prname) 46 46 47 47 def deflate(data): … … 110 110 symbol = "_binary_%s" % basename.replace(".", "_") 111 111 112 print "%s -> %s" % (component, obj)112 print("%s -> %s" % (component, obj)) 113 113 114 comp_in = file(component, "rb")114 comp_in = open(component, "rb") 115 115 comp_data = comp_in.read() 116 116 comp_in.close() … … 121 121 122 122 try: 123 comp_out = file(basename, "wb")123 comp_out = open(basename, "wb") 124 124 comp_out.write(comp_deflate) 125 125 comp_out.close() … … 151 151 cnt += 1 152 152 153 header = file(os.path.join(arch_path, "include", "%s.h" % COMPONENTS), "w")153 header = open(os.path.join(arch_path, "include", "%s.h" % COMPONENTS), "w") 154 154 155 155 header.write('/***************************************\n') … … 173 173 header.close() 174 174 175 data = file(os.path.join(arch_path, "src", "%s.c" % COMPONENTS), "w")175 data = open(os.path.join(arch_path, "src", "%s.c" % COMPONENTS), "w") 176 176 177 177 data.write('/***************************************\n') … … 187 187 data.close() 188 188 189 link_in = file(os.path.join(arch_path, "%s.in" % LINK), "r")189 link_in = open(os.path.join(arch_path, "%s.in" % LINK), "r") 190 190 template = link_in.read() 191 191 link_in.close() 192 192 193 link_out = file(os.path.join(arch_path, "%s.comp" % LINK), "w")193 link_out = open(os.path.join(arch_path, "%s.comp" % LINK), "w") 194 194 link_out.write(template.replace("[[COMPONENTS]]", "\n".join(link_ctx))) 195 195 link_out.close()
Note:
See TracChangeset
for help on using the changeset viewer.