| 1 |
#!/usr/bin/env python3 |
| 2 |
|
| 3 |
import os |
| 4 |
import sys |
| 5 |
import argparse |
| 6 |
|
| 7 |
from pathlib import Path |
| 8 |
|
| 9 |
filedir = Path(os.path.dirname(__file__)).resolve() |
| 10 |
if list(filedir.glob('ext/*tachyon.*')): |
| 11 |
sys.path.insert(0, (filedir / 'ext').as_posix()) |
| 12 |
|
| 13 |
if hasattr(os, 'add_dll_directory'): |
| 14 |
os.add_dll_directory(filedir / 'ext' / 'lib') |
| 15 |
|
| 16 |
import tachyon |
| 17 |
|
| 18 |
parser = argparse.ArgumentParser() |
| 19 |
parser.add_argument('-o', dest='output', default=None) |
| 20 |
|
| 21 |
options = parser.parse_args(sys.argv[1:]) |
| 22 |
|
| 23 |
result = tachyon.phaserize('shoot') |
| 24 |
|
| 25 |
if options.output: |
| 26 |
with open(options.output, 'w', encoding='utf-8') as f: |
| 27 |
f.write('success') |
| 28 |
|
| 29 |
if not isinstance(result, int): |
| 30 |
print('Returned result not an integer.') |
| 31 |
sys.exit(1) |
| 32 |
|
| 33 |
if result != 1: |
| 34 |
print(f'Returned result {result} is not 1.') |
| 35 |
sys.exit(1) |