Repository: pypa/pip

Issue:
Fail legacy install if .egg-info directory was not created
**What's the problem this feature will solve?**

Currently on the legacy install code path ([here](https://github.com/pypa/pip/blob/e0239735a3d8a504e00133090dde2210b6564a38/src/pip/_internal/req/req_install.py#L997-L1004)) if execution of `setup.py install ...` didn't result in an `.egg-info` directory being created we trace a warning and continue.

This is bad because we will have installed an uninstallable package and the only penalty is a small warning which is very easy to miss.

**Describe the solution you'd like**

Instead of tracing a warning we should throw an exception.

This prevents additional packages from being installed and possibly hiding the warning from users.

**Alternative Solutions**

Continue tracing the warning as before.

**Additional context**

* [this support query](https://kite.trade/forum/discussion/4335/could-not-find-egg-info-directory-in-install-record-for-kiteconnect) for [this package](https://github.com/zerodhatech/pykiteconnect/blob/7af60a776fbfafb6c30cfbd8d4f6c192618c5af5/setup.py#L48) which does an egg install in its setup.py regardless of setuptools version.
* [this query](https://stackoverflow.com/questions/26091641/what-does-a-could-not-find-egg-info-directory-in-install-record-from-pip-mean) which implicates having an older version of setuptools


Discussion:
Cool, let's give this the regular 2-release deprecation -- if no one raises major concerns w.r.t. this, we'll start raising an error there. :)
Added to milestone 20.2 (for removal)
The relevant bit of code:

https://github.com/pypa/pip/blob/0b23b772d5fc3a64e9ff77579135d70a22933c27/src/pip/_internal/operations/install/legacy.py#L109-L124

Resolving patch:
diff --git a/src/pip/_internal/operations/install/legacy.py b/src/pip/_internal/operations/install/legacy.py
--- a/src/pip/_internal/operations/install/legacy.py
+++ b/src/pip/_internal/operations/install/legacy.py
@@ -6,7 +6,7 @@
 import sys
 from distutils.util import change_root
 
-from pip._internal.utils.deprecation import deprecated
+from pip._internal.exceptions import InstallationError
 from pip._internal.utils.logging import indent_log
 from pip._internal.utils.misc import ensure_dir
 from pip._internal.utils.setuptools_build import make_setuptools_install_args
@@ -106,24 +106,12 @@ def prepend_root(path):
             egg_info_dir = prepend_root(directory)
             break
     else:
-        deprecated(
-            reason=(
-                "{} did not indicate that it installed an "
-                ".egg-info directory. Only setup.py projects "
-                "generating .egg-info directories are supported."
-            ).format(req_description),
-            replacement=(
-                "for maintainers: updating the setup.py of {0}. "
-                "For users: contact the maintainers of {0} to let "
-                "them know to update their setup.py.".format(
-                    req_name
-                )
-            ),
-            gone_in="20.2",
-            issue=6998,
-        )
-        # FIXME: put the record somewhere
-        return True
+        message = (
+            "{} did not indicate that it installed an "
+            ".egg-info directory. Only setup.py projects "
+            "generating .egg-info directories are supported."
+        ).format(req_description)
+        raise InstallationError(message)
 
     new_lines = []
     for line in record_lines:


Test patch: