@@ -736,15 +736,23 @@ def _parse_lakefile_toml_dependencies(
736736
737737 def get_license (self ) -> Optional [str ]:
738738 """Return the content of the ``LICENSE`` file."""
739- assert "github.com" in self .url , f"Unsupported URL: { self .url } "
740- url = self .url .replace ("github.com" , "raw.githubusercontent.com" )
741- license_url = f"{ url } /{ self .commit } /LICENSE"
742- try :
743- return read_url (license_url )
744- except urllib .error .HTTPError : # type: ignore
745- return None
739+ if self .repo_type == RepoType .GITHUB :
740+ assert "github.com" in self .url , f"Unsupported URL: { self .url } "
741+ url = self .url .replace ("github.com" , "raw.githubusercontent.com" )
742+ license_url = f"{ url } /{ self .commit } /LICENSE"
743+ try :
744+ return read_url (license_url )
745+ except urllib .error .HTTPError : # type: ignore
746+ return None
747+ else :
748+ license_path = Path (self .repo .working_dir ) / "LICENSE"
749+ if license_path .exists ():
750+ return license_path .open ("r" ).read ()
751+ else :
752+ return None
746753
747754 def _get_config_url (self , filename : str ) -> str :
755+ assert self .repo_type == RepoType .GITHUB
748756 assert "github.com" in self .url , f"Unsupported URL: { self .url } "
749757 url = self .url .replace ("github.com" , "raw.githubusercontent.com" )
750758 return f"{ url } /{ self .commit } /{ filename } "
@@ -767,13 +775,21 @@ def get_config(self, filename: str, num_retries: int = 2) -> Dict[str, Any]:
767775
768776 def uses_lakefile_lean (self ) -> bool :
769777 """Check if the repo uses a ``lakefile.lean``."""
770- url = self ._get_config_url ("lakefile.lean" )
771- return url_exists (url )
778+ if self .repo_type == RepoType .GITHUB :
779+ url = self ._get_config_url ("lakefile.lean" )
780+ return url_exists (url )
781+ else :
782+ lakefile_path = Path (self .repo .working_dir ) / "lakefile.lean"
783+ return lakefile_path .exists ()
772784
773785 def uses_lakefile_toml (self ) -> bool :
774786 """Check if the repo uses a ``lakefile.toml``."""
775- url = self ._get_config_url ("lakefile.toml" )
776- return url_exists (url )
787+ if self .repo_type == RepoType .GITHUB :
788+ url = self ._get_config_url ("lakefile.toml" )
789+ return url_exists (url )
790+ else :
791+ lakefile_path = Path (self .repo .working_dir ) / "lakefile.toml"
792+ return lakefile_path .exists ()
777793
778794
779795@dataclass (frozen = True )
0 commit comments