From db7164d988cb4f82198e8f03d7cac9580258d271 Mon Sep 17 00:00:00 2001 From: jxltom Date: Tue, 6 Nov 2018 12:40:44 +0800 Subject: [PATCH 1/3] Skip purging if there is no packages needs to be removed --- pipenv/core.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pipenv/core.py b/pipenv/core.py index 2091bd08..1922b28f 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -1158,6 +1158,13 @@ def do_purge(bare=False, downloads=False, allow_global=False): click.echo( fix_utf8("Found {0} installed package(s), purging…".format(len(to_remove))) ) + + # Skip purging if there is no packages which needs to be removed + if not to_remove: + if not bare: + click.echo(crayons.green("Environment now purged and fresh!")) + return installed + command = "{0} uninstall {1} -y".format( escape_grouped_arguments(which_pip(allow_global=allow_global)), " ".join(to_remove), From e53391fd49aba7663e24d747b53c8f808225e668 Mon Sep 17 00:00:00 2001 From: jxltom Date: Tue, 6 Nov 2018 12:46:52 +0800 Subject: [PATCH 2/3] Add feature news for issue 3170 --- news/3170.feature | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/3170.feature diff --git a/news/3170.feature b/news/3170.feature new file mode 100644 index 00000000..b8bc5218 --- /dev/null +++ b/news/3170.feature @@ -0,0 +1 @@ +Do not show error but success for running pipenv uninstall --all in a fresh virtuanlenv From 7b18c124488d0f9fbb652ca0e14d95b03b36b1e2 Mon Sep 17 00:00:00 2001 From: jxltom Date: Tue, 6 Nov 2018 17:55:54 +0800 Subject: [PATCH 3/3] Add explicit message if there is nothing to be removed during uninstall --- pipenv/core.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pipenv/core.py b/pipenv/core.py index 1922b28f..8636dfd4 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -1154,16 +1154,17 @@ def do_purge(bare=False, downloads=False, allow_global=False): # Remove setuptools, pip, etc from targets for removal to_remove = installed - bad_pkgs + # Skip purging if there is no packages which needs to be removed + if not to_remove: + if not bare: + click.echo("Found 0 installed package, skip purging.") + click.echo(crayons.green("Environment now purged and fresh!")) + return installed + if not bare: click.echo( fix_utf8("Found {0} installed package(s), purging…".format(len(to_remove))) ) - - # Skip purging if there is no packages which needs to be removed - if not to_remove: - if not bare: - click.echo(crayons.green("Environment now purged and fresh!")) - return installed command = "{0} uninstall {1} -y".format( escape_grouped_arguments(which_pip(allow_global=allow_global)),