From 4c51214e7ebcc568ae667991f4c1924805c75365 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Mon, 19 Mar 2018 06:46:10 -0400 Subject: [PATCH] remove --update Signed-off-by: Kenneth Reitz --- pipenv/cli.py | 16 ------------ pipenv/core.py | 71 -------------------------------------------------- 2 files changed, 87 deletions(-) diff --git a/pipenv/cli.py b/pipenv/cli.py index 802d123d..56e62969 100644 --- a/pipenv/cli.py +++ b/pipenv/cli.py @@ -61,12 +61,6 @@ def setup_verbose(ctx, param, value): invoke_without_command=True, context_settings=CONTEXT_SETTINGS, ) -@click.option( - '--update', - is_flag=True, - default=False, - help="Update Pipenv & pip to latest.", -) @click.option( '--where', is_flag=True, @@ -133,7 +127,6 @@ def cli( three=False, python=False, help=False, - update=False, py=False, site_packages=False, envs=False, @@ -156,15 +149,6 @@ def cli( sys.exit(1) sys.exit(0) from .import core - - if not update: - pass - else: - # Update pip to latest version. - core.ensure_latest_pip() - # Upgrade self to latest version. - core.ensure_latest_self() - sys.exit() if man: if core.system_which('man'): path = os.sep.join([os.path.dirname(__file__), 'pipenv.1']) diff --git a/pipenv/core.py b/pipenv/core.py index e2bf9d0d..9d61bc4b 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -169,50 +169,6 @@ def add_to_path(p): ) -def ensure_latest_self(user=False): - """Updates Pipenv to latest version, cleverly.""" - touch_update_stamp() - try: - r = requests.get('https://pypi.python.org/pypi/pipenv/json', timeout=2) - except requests.RequestException as e: - click.echo(crayons.red(e)) - sys.exit(1) - latest = max(map(semver.parse_version_info, r.json()['releases'].keys())) - current = semver.parse_version_info(__version__) - if current < latest: - import site - - click.echo( - '{0}: {1} is now available. Automatically upgrading!'.format( - crayons.green('Courtesy Notice'), - crayons.yellow( - 'Pipenv {v.major}.{v.minor}.{v.patch}'.format(v=latest) - ), - ), - err=True, - ) - # Resolve user site, enable user mode automatically. - if site.ENABLE_USER_SITE and site.USER_SITE in sys.modules[ - 'pipenv' - ].__file__: - args = ['install', '--user', '--upgrade', 'pipenv', '--no-cache'] - else: - args = ['install', '--upgrade', 'pipenv', '--no-cache'] - os.environ['PIP_PYTHON_VERSION'] = str( - '.'.join(map(str, sys.version_info[:3])) - ) - os.environ['PIP_PYTHON_PATH'] = str(sys.executable) - sys.modules['pip'].main(args) - click.echo( - '{0} to {1}!'.format( - crayons.green('Pipenv updated'), - crayons.yellow( - '{v.major}.{v.minor}.{v.patch}'.format(v=latest) - ), - ) - ) - else: - click.echo(crayons.green('All good!')) def cleanup_virtualenv(bare=True): @@ -226,33 +182,6 @@ def cleanup_virtualenv(bare=True): click.echo(e) -def ensure_latest_pip(): - """Updates pip to the latest version.""" - # Ensure that pip is installed. - try: - c = delegator.run( - '{0} install pip'.format(escape_grouped_arguments(which_pip())) - ) - # Check if version is out of date. - if 'however' in c.err: - # If version is out of date, update. - click.echo( - crayons.normal( - u'Pip is out of date… updating to latest.', bold=True - ) - ) - windows = '-m' if os.name == 'nt' else '' - c = delegator.run( - '{0} install {1} pip --upgrade'.format( - escape_grouped_arguments(which_pip()), windows - ), - block=False, - ) - click.echo(crayons.blue(c.out)) - except AttributeError: - pass - - def import_requirements(r=None, dev=False): import pip9 from pip9.req.req_file import parse_requirements