diff --git a/build/fbcode_builder/getdeps/fetcher.py b/build/fbcode_builder/getdeps/fetcher.py index 3cfd05f05..ea2cf2fd2 100644 --- a/build/fbcode_builder/getdeps/fetcher.py +++ b/build/fbcode_builder/getdeps/fetcher.py @@ -583,13 +583,16 @@ class ArchiveFetcher(Fetcher): "%s: expected sha256 %s but got %s" % (self.url, self.sha256, digest) ) - def _download(self): + def _download_dir(self): + """ returns the download dir, creating it if it doesn't already exist """ download_dir = os.path.dirname(self.file_name) if not os.path.exists(download_dir): os.makedirs(download_dir) + return download_dir + def _download(self): + self._download_dir() download_url_to_file_with_progress(self.url, self.file_name) - self._verify_hash() def clean(self): diff --git a/build/fbcode_builder/getdeps/manifest.py b/build/fbcode_builder/getdeps/manifest.py index 906afcb59..8247c0f3e 100644 --- a/build/fbcode_builder/getdeps/manifest.py +++ b/build/fbcode_builder/getdeps/manifest.py @@ -329,9 +329,20 @@ class ManifestParser(object): url = self.get("download", "url", ctx=ctx) if url: - return ArchiveFetcher( - build_options, self, url, self.get("download", "sha256", ctx=ctx) - ) + # We need to defer this import until now to avoid triggering + # a cycle when the facebook/__init__.py is loaded. + try: + from getdeps.facebook.lfs import LFSCachingArchiveFetcher + + return LFSCachingArchiveFetcher( + build_options, self, url, self.get("download", "sha256", ctx=ctx) + ) + except ImportError: + # This FB internal module isn't shippped to github, + # so just use its base class + return ArchiveFetcher( + build_options, self, url, self.get("download", "sha256", ctx=ctx) + ) raise KeyError( "project %s has no fetcher configuration matching %r" % (self.name, ctx)