| 519 | # Encode to our output encoding (likely also system's default |
| 520 | # encoding): |
| 521 | bytes = txt.encode(sys.stdout.encoding, errors='replace') |
| 522 | |
| 523 | # Decode back to string and print... we should hit no exception here |
| 524 | # since all errors have been replaced: |
| 525 | print(codecs.getdecoder(sys.stdout.encoding)(bytes)[0]) |
| 526 | print() |
| 527 | |
| 528 | |
| 529 | def run(command, logFile): |
| 530 | if cygwin: command = cygwinifyPaths(command) |
| 531 | if os.system('%s > %s 2>&1' % (command, logFile)): |
| 532 | logPath = os.path.abspath(logFile) |
| 533 | print('\ncommand "%s" failed:' % command) |
| 534 | printFileContents(logFile) |
| 535 | raise RuntimeError('command "%s" failed; see log file %s' % (command, logPath)) |
| 536 | |
| 537 | |
| 538 | def verifyDigests(artifact, urlString, tmpDir): |
| 539 | print(' verify sha512 digest') |
| 540 | sha512Expected, t = load(urlString + '.sha512').strip().split() |