From a3e8d4da41e651884848f5bb43148c12faa12f2f Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Sat, 25 Jun 2022 20:05:38 +0100 Subject: Add help message to editable install exception --- setuptools/command/editable_wheel.py | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'setuptools/command') diff --git a/setuptools/command/editable_wheel.py b/setuptools/command/editable_wheel.py index 8a0fb8bc..7a396bbe 100644 --- a/setuptools/command/editable_wheel.py +++ b/setuptools/command/editable_wheel.py @@ -15,8 +15,10 @@ import os import re import shutil import sys +import traceback import warnings from contextlib import suppress +from inspect import cleandoc from itertools import chain from pathlib import Path from tempfile import TemporaryDirectory @@ -88,14 +90,29 @@ class editable_wheel(Command): self.dist_dir = Path(self.dist_dir or os.path.join(self.project_dir, "dist")) def run(self): - self.dist_dir.mkdir(exist_ok=True) - self._ensure_dist_info() + try: + self.dist_dir.mkdir(exist_ok=True) + self._ensure_dist_info() + + # Add missing dist_info files + bdist_wheel = self.reinitialize_command("bdist_wheel") + bdist_wheel.write_wheelfile(self.dist_info_dir) + + self._create_wheel_file(bdist_wheel) + except Exception as ex: + traceback.print_exc() + msg = """ + Support for editable installs via PEP 660 was recently introduced + in `setuptools`. If you are seeing this error, please report to: + + https://github.com/pypa/setuptools/issues - # Add missing dist_info files - bdist_wheel = self.reinitialize_command("bdist_wheel") - bdist_wheel.write_wheelfile(self.dist_info_dir) + Meanwhile you can try the legacy behavior by setting an + environment variable and trying to install again: - self._create_wheel_file(bdist_wheel) + SETUPTOOLS_ENABLE_FEATURES="legacy-editable" + """ + raise errors.InternalError(cleandoc(msg)) from ex def _ensure_dist_info(self): if self.dist_info_dir is None: -- cgit v1.2.1