| 46 | |
| 47 | |
| 48 | def runAndSendGPGPassword(command, password): |
| 49 | p = subprocess.Popen(command, shell=True, bufsize=0, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE) |
| 50 | f = open(LOG, 'ab') |
| 51 | while True: |
| 52 | p.stdout.flush() |
| 53 | line = p.stdout.readline() |
| 54 | if len(line) == 0: |
| 55 | break |
| 56 | f.write(line) |
| 57 | if line.find(b'Enter GPG keystore password:') != -1: |
| 58 | time.sleep(1.0) |
| 59 | p.stdin.write((password + '\n').encode('UTF-8')) |
| 60 | p.stdin.write('\n'.encode('UTF-8')) |
| 61 | |
| 62 | try: |
| 63 | result = p.wait(timeout=120) |
| 64 | if result != 0: |
| 65 | msg = ' FAILED: %s [see log %s]' % (command, LOG) |
| 66 | print(msg) |
| 67 | raise RuntimeError(msg) |
| 68 | except TimeoutExpired: |
| 69 | msg = ' FAILED: %s [timed out after 2 minutes; see log %s]' % (command, LOG) |
| 70 | print(msg) |
| 71 | raise RuntimeError(msg) |
| 72 | |
| 73 | def load(urlString, encoding="utf-8"): |
| 74 | try: |