File tree 1 file changed +14
-5
lines changed
src/pip/_internal/operations 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change 4
4
# The following comment should be removed at some point in the future.
5
5
# mypy: strict-optional=False
6
6
7
+ import email .errors
7
8
import json
8
9
import mimetypes
9
10
import os
@@ -455,11 +456,19 @@ def _cache_metadata(
455
456
) -> None :
456
457
if self ._metadata_cache is None :
457
458
return
458
- with self ._metadata_cache .cache_path (link ).open ("w" ) as f :
459
- cacheable_dist = CacheableDist .from_dist (link , metadata_dist )
460
- args = cacheable_dist .to_json ()
461
- logger .debug ("caching metadata for link %s at %s" , link .url , f .name )
462
- json .dump (args , f )
459
+ try :
460
+ with self ._metadata_cache .cache_path (link ).open ("w" ) as f :
461
+ cacheable_dist = CacheableDist .from_dist (link , metadata_dist )
462
+ args = cacheable_dist .to_json ()
463
+ logger .debug ("caching metadata for link %s at %s" , link .url , f .name )
464
+ json .dump (args , f )
465
+ except email .errors .HeaderParseError as e :
466
+ logger .debug (
467
+ "could not cache metadata for dist %s from %s: %s" ,
468
+ metadata_dist ,
469
+ link ,
470
+ e ,
471
+ )
463
472
464
473
def _fetch_metadata_using_link_data_attr (
465
474
self ,
You can’t perform that action at this time.
0 commit comments