예제 #1
0
파일: resolver.py 프로젝트: yujunz/pipenv
def main():
    parser = get_parser()
    parsed, remaining = parser.parse_known_args()
    _patch_path(pipenv_site=parsed.pipenv_site)
    import warnings
    from pipenv.vendor.vistir.compat import ResourceWarning
    from pipenv.vendor.vistir.misc import get_wrapped_stream
    warnings.simplefilter("ignore", category=ResourceWarning)
    import six
    if six.PY3:
        stdout = sys.stdout.buffer
        stderr = sys.stderr.buffer
    else:
        stdout = sys.stdout
        stderr = sys.stderr
    sys.stderr = get_wrapped_stream(stderr)
    sys.stdout = get_wrapped_stream(stdout)
    from pipenv.vendor import colorama
    colorama.init()
    os.environ["PIP_DISABLE_PIP_VERSION_CHECK"] = str("1")
    os.environ["PYTHONIOENCODING"] = str("utf-8")
    parsed = handle_parsed_args(parsed)
    _main(parsed.pre,
          parsed.clear,
          parsed.verbose,
          parsed.system,
          parsed.requirements_dir,
          parsed.packages,
          parse_only=parsed.parse_only)
예제 #2
0
파일: resolver.py 프로젝트: ucifs/pipenv
def main():
    parser = get_parser()
    parsed, remaining = parser.parse_known_args()
    _patch_path(pipenv_site=parsed.pipenv_site)
    import warnings
    from pipenv.vendor.vistir.compat import ResourceWarning
    from pipenv.vendor.vistir.misc import get_wrapped_stream
    warnings.simplefilter("ignore", category=ResourceWarning)
    import six
    if six.PY3:
        stdout = sys.stdout.buffer
        stderr = sys.stderr.buffer
    else:
        stdout = sys.stdout
        stderr = sys.stderr
    sys.stderr = get_wrapped_stream(stderr)
    sys.stdout = get_wrapped_stream(stdout)
    from pipenv.vendor import colorama
    if os.name == "nt" and (all(
            getattr(stream, method, None)
            for stream in [sys.stdout, sys.stderr]
            for method in ["write", "isatty"])
                            and all(stream.isatty()
                                    for stream in [sys.stdout, sys.stderr])):
        stderr_wrapper = colorama.AnsiToWin32(sys.stderr,
                                              autoreset=False,
                                              convert=None,
                                              strip=None)
        stdout_wrapper = colorama.AnsiToWin32(sys.stdout,
                                              autoreset=False,
                                              convert=None,
                                              strip=None)
        sys.stderr = stderr_wrapper.stream
        sys.stdout = stdout_wrapper.stream
        colorama.init(wrap=False)
    elif os.name != "nt":
        colorama.init()
    os.environ["PIP_DISABLE_PIP_VERSION_CHECK"] = str("1")
    os.environ["PYTHONIOENCODING"] = str("utf-8")
    os.environ["PYTHONUNBUFFERED"] = str("1")
    parsed = handle_parsed_args(parsed)
    _main(parsed.pre,
          parsed.clear,
          parsed.verbose,
          parsed.system,
          parsed.write,
          parsed.requirements_dir,
          parsed.packages,
          parse_only=parsed.parse_only)
예제 #3
0
    from pipenv.vendor.vistir.compat import ResourceWarning
    warnings.simplefilter("ignore", category=ResourceWarning)
    import io
    import six
    if six.PY3:
        import atexit
        stdout_wrapper = io.TextIOWrapper(sys.stdout.buffer, encoding='utf8')
        atexit.register(stdout_wrapper.close)
        stderr_wrapper = io.TextIOWrapper(sys.stderr.buffer, encoding='utf8')
        atexit.register(stderr_wrapper.close)
        sys.stdout = stdout_wrapper
        sys.stderr = stderr_wrapper
    else:
        from pipenv._compat import force_encoding
        force_encoding()
    os.environ["PIP_DISABLE_PIP_VERSION_CHECK"] = str("1")
    os.environ["PYTHONIOENCODING"] = str("utf-8")
    parser = get_parser()
    parsed, remaining = parser.parse_known_args()
    # sys.argv = remaining
    parsed = handle_parsed_args(parsed)
    _main(parsed.pre, parsed.clear, parsed.verbose, parsed.system,
          parsed.requirements_dir, parsed.packages)


if __name__ == "__main__":
    _patch_path()
    from pipenv.vendor import colorama
    colorama.init()
    main()