From 1b2ae22e7b0b2d1963bec769d4f070bfbc6d932a Mon Sep 17 00:00:00 2001 From: Pradyun Gedam Date: Mon, 27 Jul 2020 14:13:59 +0530 Subject: [PATCH] Don't print that form link after the end of month. --- src/pip/_internal/commands/install.py | 3 ++- src/pip/_internal/utils/datetime.py | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 src/pip/_internal/utils/datetime.py diff --git a/src/pip/_internal/commands/install.py b/src/pip/_internal/commands/install.py index 3cefa5ae6..8c2c32fd4 100644 --- a/src/pip/_internal/commands/install.py +++ b/src/pip/_internal/commands/install.py @@ -21,6 +21,7 @@ from pip._internal.locations import distutils_scheme from pip._internal.operations.check import check_install_conflicts from pip._internal.req import install_given_reqs from pip._internal.req.req_tracker import get_requirement_tracker +from pip._internal.utils.datetime import today_is_later_than from pip._internal.utils.deprecation import deprecated from pip._internal.utils.distutils_args import parse_distutils_args from pip._internal.utils.filesystem import test_writable_dir @@ -557,7 +558,7 @@ class InstallCommand(RequirementCommand): "your packages with the new resolver before it becomes the " "default.\n" ) - else: + elif not today_is_later_than(year=2020, month=7, day=31): # NOTE: trailing newlines here are intentional parts.append( "Pip will install or upgrade your package(s) and its " diff --git a/src/pip/_internal/utils/datetime.py b/src/pip/_internal/utils/datetime.py new file mode 100644 index 000000000..b638646c8 --- /dev/null +++ b/src/pip/_internal/utils/datetime.py @@ -0,0 +1,12 @@ +"""For when pip wants to check the date or time. +""" + +import datetime + + +def today_is_later_than(year, month, day): + # type: (int, int, int) -> bool + today = datetime.date.today() + given = datetime.date(year, month, day) + + return today > given