Exemplo n.º 1
0
Arquivo: main.py Projeto: tony/mypy
def main(script_path: str) -> None:
    """Main entry point to the type checker.

    Args:
        script_path: Path to the 'mypy' script (used for finding data files).
    """
    if script_path:
        bin_dir = find_bin_directory(script_path)
    else:
        bin_dir = None
    sources, options = process_options()
    if options.pdb:
        set_drop_into_pdb(True)
    if not options.dirty_stubs:
        git.verify_git_integrity_or_abort(build.default_data_dir(bin_dir))
    f = sys.stdout
    try:
        if options.target == build.TYPE_CHECK:
            res = type_check_only(sources, bin_dir, options)
            a = res.errors
        else:
            raise RuntimeError('unsupported target %d' % options.target)
    except CompileError as e:
        a = e.messages
        if not e.use_stdout:
            f = sys.stderr
    if a:
        for m in a:
            f.write(m + '\n')
        sys.exit(1)
Exemplo n.º 2
0
def main(script_path: str) -> None:
    """Main entry point to the type checker.

    Args:
        script_path: Path to the 'mypy' script (used for finding data files).
    """
    if script_path:
        bin_dir = find_bin_directory(script_path)
    else:
        bin_dir = None
    sources, options = process_options(sys.argv[1:])
    if options.pdb:
        set_drop_into_pdb(True)
    if options.show_traceback:
        set_show_tb(True)
    f = sys.stdout
    try:
        res = type_check_only(sources, bin_dir, options)
        a = res.errors
    except CompileError as e:
        a = e.messages
        if not e.use_stdout:
            f = sys.stderr
    if a:
        for m in a:
            f.write(m + "\n")
        sys.exit(1)
Exemplo n.º 3
0
Arquivo: main.py Projeto: gnprice/mypy
def main(script_path: str) -> None:
    """Main entry point to the type checker.

    Args:
        script_path: Path to the 'mypy' script (used for finding data files).
    """
    if script_path:
        bin_dir = find_bin_directory(script_path)
    else:
        bin_dir = None
    sources, options = process_options()
    if options.pdb:
        set_drop_into_pdb(True)
    if not options.dirty_stubs:
        git.verify_git_integrity_or_abort(build.default_data_dir(bin_dir))
    f = sys.stdout
    try:
        if options.target == build.TYPE_CHECK:
            res = type_check_only(sources, bin_dir, options)
            a = res.errors
        else:
            raise RuntimeError("unsupported target %d" % options.target)
    except CompileError as e:
        a = e.messages
        if not e.use_stdout:
            f = sys.stderr
    if a:
        for m in a:
            f.write(m + "\n")
        sys.exit(1)
Exemplo n.º 4
0
Arquivo: main.py Projeto: alsuren/mypy
def main(script_path: str) -> None:
    """Main entry point to the type checker.

    Args:
        script_path: Path to the 'mypy' script (used for finding data files).
    """
    if script_path:
        bin_dir = find_bin_directory(script_path)
    else:
        bin_dir = None
    sources, options = process_options(sys.argv[1:])
    if options.pdb:
        set_drop_into_pdb(True)
    if options.show_traceback:
        set_show_tb(True)
    f = sys.stdout
    try:
        res = type_check_only(sources, bin_dir, options)
        a = res.errors
    except CompileError as e:
        a = e.messages
        if not e.use_stdout:
            f = sys.stderr
    if a:
        for m in a:
            f.write(m + '\n')
        sys.exit(1)