/usr/lib/python2.7/dist-packages/PySPH-1.0a4.dev0-py2.7-linux-x86_64.egg/pysph/tools/cli.py is in python-pysph 0~20160514.git91867dc-4build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | """Convenience script for running various PySPH related tasks.
"""
from __future__ import print_function
from argparse import ArgumentParser
from os.path import exists, join
import sys
def run_viewer(args):
from pysph.tools.mayavi_viewer import main
main(args)
def run_examples(args):
from pysph.examples.run import main
main(args)
def output_vtk(args):
from pysph.solver.vtk_output import main
main(args)
def _has_pysph_dir():
init_py = join('pysph', '__init__.py')
init_pyc = join('pysph', '__init__.pyc')
return exists(init_py) or exists(init_pyc)
def run_tests(args):
wd = ['-w', 'docs'] if _has_pysph_dir() else []
argv = ['nosetests', 'pysph', 'pyzoltan'] + wd + args
from nose.core import main
main(argv=argv)
def main():
parser = ArgumentParser(description=__doc__, add_help=False)
parser.add_argument(
"-h", "--help", action="store_true", default=False, dest="help",
help="show this help message and exit"
)
subparsers = parser.add_subparsers(help='sub-command help')
viewer = subparsers.add_parser(
'view', help='View output files generated by PySPH',
add_help=False
)
viewer.set_defaults(func=run_viewer)
runner = subparsers.add_parser(
'run', help='Run PySPH examples',
add_help=False
)
runner.set_defaults(func=run_examples)
vtk_out = subparsers.add_parser(
'dump_vtk', help='Dump VTK Output',
add_help=False
)
vtk_out.set_defaults(func=output_vtk)
tests = subparsers.add_parser(
'test', help='Run entire PySPH test-suite',
add_help=False
)
tests.set_defaults(func=run_tests)
if len(sys.argv) == 1 or \
(len(sys.argv) > 1 and sys.argv[1] in ['-h', '--help']):
parser.print_help()
sys.exit()
args, extra = parser.parse_known_args()
args.func(extra)
if __name__ == '__main__':
main()
|