File tree 1 file changed +11
-1
lines changed 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 11
11
"use_netrc" ,
12
12
)
13
13
14
+ def _is_empty (ctx ):
15
+ """Returns true if the metadata indicates that this is an empty archive."""
16
+ files_list = ctx .path ("info/files" )
17
+ if files_list .exists :
18
+ return not ctx .read (files_list ).strip ()
19
+ paths_json = ctx .path ("info/paths.json" )
20
+ if not paths_json .exists :
21
+ fail ("Archive contained neither info/files nor info/paths.json" )
22
+ return not json .decode (ctx .read (paths_json )).get ("paths" )
23
+
14
24
def _conda_package_repository_impl (ctx ):
15
25
# Get this path here, because it might trigger a restart of the fetch,
16
26
# which would be better to have happen before we download anything.
@@ -53,7 +63,7 @@ def _conda_package_repository_impl(ctx):
53
63
ctx .delete ("info-{}.tar.zst" .format (ctx .attr .dist_name ))
54
64
55
65
# Do not attempt to untar empty archives.
56
- if ctx . read ( "info/files" ). strip ( ):
66
+ if not _is_empty ( ctx ):
57
67
ctx .extract ("pkg-{}.tar.zst" .format (ctx .attr .dist_name ))
58
68
ctx .delete ("pkg-{}.tar.zst" .format (ctx .attr .dist_name ))
59
69
else :
You can’t perform that action at this time.
0 commit comments