From f60d15ca87ad791e5d6f74c608d2a1b0a254f87e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul=20=28ACSONE=29?= Date: Sat, 14 Dec 2019 13:25:28 +0100 Subject: [PATCH 1/5] Add missing error report Use the same error message as in WheelBuilder.build(), include the exception in the message. --- src/pip/_internal/wheel_builder.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pip/_internal/wheel_builder.py b/src/pip/_internal/wheel_builder.py index fd850c17a23..eaea7bcf9b0 100644 --- a/src/pip/_internal/wheel_builder.py +++ b/src/pip/_internal/wheel_builder.py @@ -375,7 +375,11 @@ def _build_one_inside_env( wheel_hash.hexdigest()) logger.info('Stored in directory: %s', output_dir) return dest_path - except Exception: + except Exception as e: + logger.warning( + "Building wheel for %s failed: %s", + req.name, e, + ) pass # Ignore return, we can't do anything else useful. self._clean_one(req) From 5de1d5161039d0e7ae51a488d41491d40d4f74ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul=20=28ACSONE=29?= Date: Sat, 14 Dec 2019 13:27:57 +0100 Subject: [PATCH 2/5] Ensure output directory is present inside _build_one --- src/pip/_internal/wheel_builder.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pip/_internal/wheel_builder.py b/src/pip/_internal/wheel_builder.py index eaea7bcf9b0..87452f6949d 100644 --- a/src/pip/_internal/wheel_builder.py +++ b/src/pip/_internal/wheel_builder.py @@ -367,6 +367,7 @@ def _build_one_inside_env( wheel_name = os.path.basename(wheel_path) dest_path = os.path.join(output_dir, wheel_name) try: + ensure_dir(output_dir) wheel_hash, length = hash_file(wheel_path) shutil.move(wheel_path, dest_path) logger.info('Created wheel for %s: ' From 2f125342e04c3a984beff21b2b2a108b4ed267cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul=20=28ACSONE=29?= Date: Sat, 14 Dec 2019 13:29:04 +0100 Subject: [PATCH 3/5] Remove now redundant ensure_dir Since _build_one ensure the output dir is present and does proper error logging, we can remove ensure_dir from build(), further simplifying that method. --- src/pip/_internal/wheel_builder.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/pip/_internal/wheel_builder.py b/src/pip/_internal/wheel_builder.py index 87452f6949d..2dc4313d4d9 100644 --- a/src/pip/_internal/wheel_builder.py +++ b/src/pip/_internal/wheel_builder.py @@ -444,16 +444,6 @@ def build( with indent_log(): build_success, build_failure = [], [] for req, cache_dir in buildset: - try: - ensure_dir(cache_dir) - except OSError as e: - logger.warning( - "Building wheel for %s failed: %s", - req.name, e, - ) - build_failure.append(req) - continue - wheel_file = self._build_one(req, cache_dir) if wheel_file: if should_unpack: From 45222a2b3672b04dd8ebe30774970caa17f7f5b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul=20=28ACSONE=29?= Date: Sun, 15 Dec 2019 12:51:28 +0100 Subject: [PATCH 4/5] ensure cache dir is present before building --- src/pip/_internal/wheel_builder.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pip/_internal/wheel_builder.py b/src/pip/_internal/wheel_builder.py index 2dc4313d4d9..1937219d07c 100644 --- a/src/pip/_internal/wheel_builder.py +++ b/src/pip/_internal/wheel_builder.py @@ -334,6 +334,15 @@ def _build_one( :return: The filename of the built wheel, or None if the build failed. """ + try: + ensure_dir(output_dir) + except OSError as e: + logger.warning( + "Building wheel for %s failed: %s", + req.name, e, + ) + return None + # Install build deps into temporary directory (PEP 518) with req.build_env: return self._build_one_inside_env(req, output_dir) @@ -367,7 +376,6 @@ def _build_one_inside_env( wheel_name = os.path.basename(wheel_path) dest_path = os.path.join(output_dir, wheel_name) try: - ensure_dir(output_dir) wheel_hash, length = hash_file(wheel_path) shutil.move(wheel_path, dest_path) logger.info('Created wheel for %s: ' From 2a1fb915e2d2a579fa733359f0723c977a8eaf6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul=20=28ACSONE=29?= Date: Mon, 16 Dec 2019 17:44:34 +0100 Subject: [PATCH 5/5] Remove useless pass statement Co-Authored-By: Christopher Hunt --- src/pip/_internal/wheel_builder.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pip/_internal/wheel_builder.py b/src/pip/_internal/wheel_builder.py index 1937219d07c..e3212ded72b 100644 --- a/src/pip/_internal/wheel_builder.py +++ b/src/pip/_internal/wheel_builder.py @@ -389,7 +389,6 @@ def _build_one_inside_env( "Building wheel for %s failed: %s", req.name, e, ) - pass # Ignore return, we can't do anything else useful. self._clean_one(req) return None