Beispiel #1
0
        def save_benchmark(cmd):
            self.count += 1
            # create unique filename
            cmdmap = lambda p: ''.join(c for c in p
                                       if c not in set(string.punctuation))
            cmdmap2 = lambda p: p.replace(' ', '_')
            cmdcpy = map(cmdmap, cmd[7:])
            cmdcpy = map(cmdmap2, cmdcpy)
            filename = '_'.join(cmdcpy)
            filename = str(self.count) + '_' + filename
            filename = os.path.join(parent_dir, filename)

            stdout = sys.stdout
            with open(filename, 'w') as statsout:
                sys.stdout = statsout
                args, stats = cli.main(cmd)
                for s in stats:
                    args[s] = stats[s]
                if not self.sortedKeys:
                    self.sortedKeys = sorted(args.keys(), reverse=True)
                    header = ','.join(self.sortedKeys) + "\n"
                    cumulated_out.write(header)
                cumulated_out.write(','.join(map(lambda x: str(args.get(x)),
                                                 self.sortedKeys))
                                    + "\n")
                cumulated_out.flush()
Beispiel #2
0
def test_help(capfd):
    with pytest.raises(SystemExit) as pytest_wrapped_ex:
        r = main(['--help'])
    assert pytest_wrapped_ex.type == SystemExit
    assert pytest_wrapped_ex.value.code == 0
    out, err = capfd.readouterr()
    assert '-h, --help' in out
Beispiel #3
0
        under certain conditions; for details start the program with
        the `show --c' option.\n
    """

    print(s)
else:
    print("License File Changed or Missing. Quitting Program.")
    exit(0)


def notfound_message(exception):
    print(exception)
    print(
        f"Missing '{exception.name}' module.  If you ran 'pipenv install', try 'pipenv install {exception.name}'"
    )
    print("Exiting...")


try:
    from cli import cli
except ModuleNotFoundError as e:
    notfound_message(e)
    exit(0)

if __name__ == "__main__":
    try:
        cli.main()
    except ModuleNotFoundError as e:
        notfound_message(e)
        exit(0)
Beispiel #4
0
"""Convenience wrapper for running tfimgsort directly from source tree."""

from cli.cli import main

if __name__ == '__main__':
    main()
"""
virtual-manager.py is a script which aims to manage Vagrant-powered virtual
machines. More precisely it gives them names and references them in the
/etc/hosts to make them easily accessible.

You obviously must have a working Python 2.x and Vagrant installation.

Windows support: ah ah.
"""
from os import path, makedirs
from config import config
import vms
import provisions
from cli import cli


# Executes the entry point of the CLI: interacts with the user.
if __name__ == '__main__':
    directory = path.expanduser(config.core.get('core', 'vms_path'))
    if not path.isdir(directory):
        makedirs(directory)
    
    cli.main()
Beispiel #6
0
 def test_prints_cli(self):
     main()
Beispiel #7
0
def main():

    cli.main()