| 41 | |
| 42 | |
| 43 | def main(): |
| 44 | |
| 45 | implementations = 'rR' |
| 46 | timeout = None |
| 47 | i = 1 |
| 48 | while i < len(sys.argv): |
| 49 | arg = sys.argv[i] |
| 50 | if arg == '-i': |
| 51 | i += 1 |
| 52 | implementations = sys.argv[i] |
| 53 | elif arg == '-t': |
| 54 | i += 1 |
| 55 | timeout = float(sys.argv[i]) |
| 56 | elif arg.startswith('-'): |
| 57 | raise Exception(f'Unrecognised {arg=}.') |
| 58 | else: |
| 59 | break |
| 60 | i += 1 |
| 61 | args = sys.argv[i:] |
| 62 | |
| 63 | e_rebased = None |
| 64 | e_rebased_unoptimised = None |
| 65 | |
| 66 | endtime = None |
| 67 | if timeout: |
| 68 | endtime = time.time() + timeout |
| 69 | |
| 70 | # Check `implementations`. |
| 71 | implementations_seen = set() |
| 72 | for i in implementations: |
| 73 | assert i not in implementations_seen, f'Duplicate implementation {i!r} in {implementations!r}.' |
| 74 | if i == 'r': |
| 75 | name = 'rebased' |
| 76 | elif i == 'R': |
| 77 | name = 'rebased (unoptimised)' |
| 78 | else: |
| 79 | assert 0, f'Unrecognised implementation {i!r} in {implementations!r}.' |
| 80 | log(f' {i!r}: will run with PyMuPDF {name}.') |
| 81 | implementations_seen.add(i) |
| 82 | |
| 83 | for i in implementations: |
| 84 | log(f'run_compound.py: {i=}') |
| 85 | |
| 86 | cpu_bits = int.bit_length(sys.maxsize+1) |
| 87 | log(f'{os.getcwd()=}') |
| 88 | log(f'{platform.machine()=}') |
| 89 | log(f'{platform.platform()=}') |
| 90 | log(f'{platform.python_version()=}') |
| 91 | log(f'{platform.system()=}') |
| 92 | if sys.implementation.name != 'graalpy': |
| 93 | log(f'{platform.uname()=}') |
| 94 | log(f'{sys.executable=}') |
| 95 | log(f'{sys.version=}') |
| 96 | log(f'{sys.version_info=}') |
| 97 | log(f'{list(sys.version_info)=}') |
| 98 | log(f'{cpu_bits=}') |
| 99 | |
| 100 | timeout = None |