Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if line.split("==")[0] in BAD_PACKAGES and not reverse:
continue
# Bold top-level packages.
if not line.startswith(" "):
click.echo(crayons.normal(line, bold=True))
# Echo the rest.
else:
click.echo(crayons.normal(line, bold=False))
else:
click.echo(c.out)
if c.return_code != 0:
click.echo(
"{0} {1}".format(
crayons.red("ERROR: ", bold=True),
crayons.white("{0}".format(c.err, bold=True)),
),
err=True,
)
# Return its return code.
sys.exit(c.return_code)
package, more_packages, three, python, pypi_mirror, verbose, clear,
keep_outdated, pre, dev, bare, sequential, dry_run, outdated,
):
ensure_project(three=three, python=python, warn=True)
if not outdated:
outdated = bool(dry_run)
if outdated:
_do_outdated(pypi_mirror=pypi_mirror)
if not package:
click.echo(
'{0} {1} {2} {3}{4}'.format(
crayons.white('Running', bold=True),
crayons.red('$ pipenv lock', bold=True),
crayons.white('then', bold=True),
crayons.red('$ pipenv sync', bold=True),
crayons.white('.', bold=True),
)
)
else:
for package in ([package] + list(more_packages)):
if package not in project.all_packages:
click.echo(
'{0}: {1} was not found in your Pipfile! Aborting.'
''.format(
crayons.red('Warning', bold=True),
crayons.green(package, bold=True),
),
err=True,
)
sys.exit(1)
do_lock(
verbose=verbose, clear=clear, pre=pre,
crayons.red(
"Your Pipfile.lock ({0}) is out of date. Expected: ({1}).".format(
old_hash[-6:], new_hash[-6:]
)
)
)
raise exceptions.DeployException
sys.exit(1)
elif (system or allow_global) and not (PIPENV_VIRTUALENV):
click.echo(
crayons.red(fix_utf8(
"Pipfile.lock ({0}) out of date, but installation "
"uses {1}… re-building lockfile must happen in "
"isolation. Please rebuild lockfile in a virtualenv. "
"Continuing anyway…".format(
crayons.white(old_hash[-6:]), crayons.white("--system")
)),
bold=True,
),
err=True,
)
else:
if old_hash:
msg = fix_utf8("Pipfile.lock ({0}) out of date, updating to ({1})…")
else:
msg = fix_utf8("Pipfile.lock is corrupted, replaced with ({1})…")
click.echo(
crayons.red(msg.format(old_hash[-6:], new_hash[-6:]), bold=True),
err=True,
)
do_lock(
system=system,
if line.split('==')[0] in BAD_PACKAGES and not reverse:
continue
# Bold top-level packages.
if not line.startswith(' '):
click.echo(crayons.normal(line, bold=True))
# Echo the rest.
else:
click.echo(crayons.normal(line, bold=False))
else:
click.echo(c.out)
if c.return_code != 0:
click.echo(
'{0} {1}'.format(
crayons.red('ERROR: ', bold=True),
crayons.white('{0}'.format(c.err, bold=True)),
),
err=True
)
# Return its return code.
sys.exit(c.return_code)
def show(self, file=None):
if file is None:
file = vistir.misc.get_text_stderr()
click_echo("{0} {1}".format(
crayons.red("Error running command: "),
crayons.white(decode_for_output("$ {0}".format(self.cmd), file), bold=True)
), err=True)
if self.out:
click_echo("{0} {1}".format(
crayons.white("OUTPUT: "),
decode_for_output(self.out, file)
), err=True)
if self.err:
click_echo("{0} {1}".format(
crayons.white("STDERR: "),
decode_for_output(self.err, file)
), err=True)
def do_update(
package, more_packages, three, python, pypi_mirror, verbose, clear,
keep_outdated, pre, dev, bare, sequential, dry_run, outdated,
):
ensure_project(three=three, python=python, warn=True)
if not outdated:
outdated = bool(dry_run)
if outdated:
_do_outdated(pypi_mirror=pypi_mirror)
if not package:
click.echo(
'{0} {1} {2} {3}{4}'.format(
crayons.white('Running', bold=True),
crayons.red('$ pipenv lock', bold=True),
crayons.white('then', bold=True),
crayons.red('$ pipenv sync', bold=True),
crayons.white('.', bold=True),
)
)
else:
for package in ([package] + list(more_packages)):
if package not in project.all_packages:
click.echo(
'{0}: {1} was not found in your Pipfile! Aborting.'
''.format(
crayons.red('Warning', bold=True),
crayons.green(package, bold=True),
),
err=True,
(k, getattr(req, k, None)) for k in slots
if getattr(req, k, None)
]
req_value = "\n".join([
" {0}: {1}".format(k, v) for k, v in slot_vals
])
elif keys_fn:
values = [(k, req.get(k)) for k in keys_fn() if req.get(k)]
req_value = "\n".join([
" {0}: {1}".format(k, v) for k, v in values
])
else:
req_value = getattr(req.line_instance, "line", None)
message = "{0} {1}".format(
crayons.normal(decode_for_output("Failed creating requirement instance")),
crayons.white(decode_for_output("{0!r}".format(req_value)))
)
extra = [str(req)]
PipenvException.__init__(self, message, extra=extra)
project,
)
ensure_project(
three=state.three, python=state.python, pypi_mirror=state.pypi_mirror,
warn=(not state.quiet), site_packages=state.site_packages, clear=state.clear
)
if not outdated:
outdated = bool(dry_run)
if outdated:
do_outdated(clear=state.clear, pre=state.installstate.pre, pypi_mirror=state.pypi_mirror)
packages = [p for p in state.installstate.packages if p]
editable = [p for p in state.installstate.editables if p]
if not packages:
echo(
"{0} {1} {2} {3}{4}".format(
crayons.white("Running", bold=True),
crayons.red("$ pipenv lock", bold=True),
crayons.white("then", bold=True),
crayons.red("$ pipenv sync", bold=True),
crayons.white(".", bold=True),
)
)
else:
for package in packages + editable:
if package not in project.all_packages:
echo(
"{0}: {1} was not found in your Pipfile! Aborting."
"".format(
crayons.red("Warning", bold=True),
crayons.green(package, bold=True),
),
err=True,
ensure_project(
three=state.three, python=state.python, pypi_mirror=state.pypi_mirror,
warn=(not state.quiet), site_packages=state.site_packages, clear=state.clear
)
if not outdated:
outdated = bool(dry_run)
if outdated:
do_outdated(clear=state.clear, pre=state.installstate.pre, pypi_mirror=state.pypi_mirror)
packages = [p for p in state.installstate.packages if p]
editable = [p for p in state.installstate.editables if p]
if not packages:
echo(
"{0} {1} {2} {3}{4}".format(
crayons.white("Running", bold=True),
crayons.red("$ pipenv lock", bold=True),
crayons.white("then", bold=True),
crayons.red("$ pipenv sync", bold=True),
crayons.white(".", bold=True),
)
)
else:
for package in packages + editable:
if package not in project.all_packages:
echo(
"{0}: {1} was not found in your Pipfile! Aborting."
"".format(
crayons.red("Warning", bold=True),
crayons.green(package, bold=True),
),
err=True,
)
ctx.abort()