def __init__(self, message, no_version_found=False): extra = ( "{}: Your dependencies could not be resolved. You likely have a " "mismatch in your sub-dependencies.\n " "First try clearing your dependency cache with {}, then try the original command again.\n " "Alternatively, you can use {} to bypass this mechanism, then run " "{} to inspect the situation.\n " "Hint: try {} if it is a pre-release dependency." "".format( crayons.red("Warning", bold=True), crayons.yellow("$ pipenv lock --clear"), crayons.yellow("$ pipenv install --skip-lock"), crayons.yellow("$ pipenv graph"), crayons.yellow("$ pipenv lock --pre"), ), ) if "no version found at all" in message: no_version_found = True message = crayons.yellow(f"{message}") if no_version_found: message = "{}\n{}".format( message, crayons.cyan( "Please check your version specifier and version number. " "See PEP440 for more information." ) ) PipenvException.__init__(self, message, extra=extra)
def __init__(self, path, **kwargs): message = "{} {}\n{}".format( crayons.cyan("Corrupt cache file"), crayons.normal(f"{path!s}"), crayons.normal('Consider trying "pipenv lock --clear" to clear the cache.') ) PipenvException.__init__(self, message=message)
def __init__(self, package, command, return_values, return_code, **kwargs): extra = [ "{} {}".format(crayons.cyan("Attempted to run command: "), crayons.yellow(f"$ {command!r}", bold=True)) ] extra.extend([ crayons.cyan(line.strip()) for line in return_values.splitlines() ]) if isinstance(package, (tuple, list, set)): package = " ".join(package) message = "{!s} {!s}...".format( crayons.normal("Failed to uninstall package(s)"), crayons.yellow(f"{package}!s", bold=True)) self.exit_code = return_code PipenvException.__init__(self, message=message, extra=extra) self.extra = extra
def __init__(self, option_name="system", message=None, ctx=None, **kwargs): extra = kwargs.pop("extra", []) extra += [ "{}: --system is intended to be used for Pipfile installation, " "not installation of specific packages. Aborting.".format( crayons.red("Warning", bold=True) ), ] if message is None: message = str( crayons.cyan("See also: {}".format(crayons.normal("--deploy flag."))) ) super().__init__(option_name, message=message, ctx=ctx, extra=extra, **kwargs)