blaster.py 693 B

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