(
self,
fetcher, # type: URLFetcher
download_dir, # type: str
lock_name, # type: str
)
| 363 | url = attr.ib() # type: ArtifactURL |
| 364 | |
| 365 | def _resolve_lock( |
| 366 | self, |
| 367 | fetcher, # type: URLFetcher |
| 368 | download_dir, # type: str |
| 369 | lock_name, # type: str |
| 370 | ): |
| 371 | # type: (...) -> bool |
| 372 | |
| 373 | lock_url = ArtifactURL.from_url_info( |
| 374 | self.url.url_info._replace( |
| 375 | path=posixpath.join(posixpath.dirname(self.url.path), lock_name) |
| 376 | ) |
| 377 | ) |
| 378 | try: |
| 379 | with fetcher.get_body_stream(lock_url.download_url) as src_fp, open( |
| 380 | os.path.join(download_dir, lock_name), "wb" |
| 381 | ) as dst_fp: |
| 382 | shutil.copyfileobj(src_fp, dst_fp) |
| 383 | except (IOError, OSError): |
| 384 | return False |
| 385 | else: |
| 386 | return True |
| 387 | |
| 388 | def _resolve_script( |
| 389 | self, |
no test coverage detected