4545)
4646load (
4747 ":utils.bzl" ,
48+ "get_auth" ,
4849 "patch" ,
49- "read_netrc" ,
50- "read_user_netrc" ,
5150 "update_attrs" ,
52- "use_netrc" ,
5351 "workspace_and_buildfile" ,
5452)
5553
@@ -119,16 +117,6 @@ Authorization: Bearer RANDOM-TOKEN
119117</pre>
120118"""
121119
122- def _get_auth (ctx , urls ):
123- """Given the list of URLs obtain the correct auth dict."""
124- if ctx .attr .netrc :
125- netrc = read_netrc (ctx , ctx .attr .netrc )
126- elif "NETRC" in ctx .os .environ :
127- netrc = read_netrc (ctx , ctx .os .environ ["NETRC" ])
128- else :
129- netrc = read_user_netrc (ctx )
130- return use_netrc (netrc , urls , ctx .attr .auth_patterns )
131-
132120def _update_integrity_attr (ctx , attrs , download_info ):
133121 # We don't need to override the integrity attribute if sha256 is already specified.
134122 integrity_override = {} if ctx .attr .sha256 else {"integrity" : download_info .integrity }
@@ -140,7 +128,7 @@ def _http_archive_impl(ctx):
140128 fail ("Only one of build_file and build_file_content can be provided." )
141129
142130 all_urls = _get_all_urls (ctx )
143- auth = _get_auth (ctx , all_urls )
131+ auth = get_auth (ctx , all_urls )
144132
145133 download_info = ctx .download_and_extract (
146134 all_urls ,
@@ -182,7 +170,7 @@ def _http_file_impl(ctx):
182170 if download_path in forbidden_files or not str (download_path ).startswith (str (repo_root )):
183171 fail ("'%s' cannot be used as downloaded_file_path in http_file" % ctx .attr .downloaded_file_path )
184172 all_urls = _get_all_urls (ctx )
185- auth = _get_auth (ctx , all_urls )
173+ auth = get_auth (ctx , all_urls )
186174 download_info = ctx .download (
187175 all_urls ,
188176 "file/" + downloaded_file_path ,
@@ -219,7 +207,7 @@ filegroup(
219207def _http_jar_impl (ctx ):
220208 """Implementation of the http_jar rule."""
221209 all_urls = _get_all_urls (ctx )
222- auth = _get_auth (ctx , all_urls )
210+ auth = get_auth (ctx , all_urls )
223211 downloaded_file_name = ctx .attr .downloaded_file_name
224212 download_info = ctx .download (
225213 all_urls ,
0 commit comments