@@ -1102,7 +1102,7 @@ def build(
1102
1102
:param should_unpack: If True, after building the wheel, unpack it
1103
1103
and replace the sdist with the unpacked version in preparation
1104
1104
for installation.
1105
- :return: True if all the wheels built correctly .
1105
+ :return: The list of InstallRequirement that failed to build .
1106
1106
"""
1107
1107
# pip install uses should_unpack=True.
1108
1108
# pip install never provides a _wheel_dir.
@@ -1124,19 +1124,15 @@ def build(
1124
1124
):
1125
1125
continue
1126
1126
1127
- # Determine where the wheel should go.
1128
- if should_unpack :
1129
- if (
1130
- cache_available and
1131
- should_cache (req , self .check_binary_allowed )
1132
- ):
1133
- output_dir = self .wheel_cache .get_path_for_link (req .link )
1134
- else :
1135
- output_dir = self .wheel_cache .get_ephem_path_for_link (
1136
- req .link
1137
- )
1127
+ if (
1128
+ cache_available and
1129
+ should_cache (req , self .check_binary_allowed )
1130
+ ):
1131
+ output_dir = self .wheel_cache .get_path_for_link (req .link )
1138
1132
else :
1139
- output_dir = self ._wheel_dir
1133
+ output_dir = self .wheel_cache .get_ephem_path_for_link (
1134
+ req .link
1135
+ )
1140
1136
1141
1137
buildset .append ((req , output_dir ))
1142
1138
@@ -1174,10 +1170,6 @@ def build(
1174
1170
python_tag = python_tag ,
1175
1171
)
1176
1172
if wheel_file :
1177
- build_success .append (req )
1178
- self .wheel_filenames .append (
1179
- os .path .relpath (wheel_file , output_dir )
1180
- )
1181
1173
if should_unpack :
1182
1174
# XXX: This is mildly duplicative with prepare_files,
1183
1175
# but not close enough to pull out to a single common
@@ -1202,6 +1194,25 @@ def build(
1202
1194
assert req .link .is_wheel
1203
1195
# extract the wheel into the dir
1204
1196
unpack_file (req .link .file_path , req .source_dir )
1197
+ else :
1198
+ # copy from cache to target directory
1199
+ try :
1200
+ ensure_dir (self ._wheel_dir )
1201
+ shutil .copy (
1202
+ os .path .join (output_dir , wheel_file ),
1203
+ self ._wheel_dir ,
1204
+ )
1205
+ except OSError as e :
1206
+ logger .warning (
1207
+ "Building wheel for %s failed: %s" ,
1208
+ req .name , e ,
1209
+ )
1210
+ build_failure .append (req )
1211
+ continue
1212
+ self .wheel_filenames .append (
1213
+ os .path .relpath (wheel_file , output_dir )
1214
+ )
1215
+ build_success .append (req )
1205
1216
else :
1206
1217
build_failure .append (req )
1207
1218
0 commit comments