@@ -78,6 +78,11 @@ def init_submodules(
7878 github_repo_mlpcpp = "https://github.com/EvertBunschoten/MLPCpp"
7979 sha_version_eigen = "d71c30c47858effcbd39967097a2d99ee48db464"
8080 github_repo_eigen = "https://gitlab.com/libeigen/eigen.git"
81+ # The download paths for gitlab are different than github so we need this ad-hoc fix.
82+ # NOTE: Update the Eigen version in download_module when changing this.
83+ download_eigen = (
84+ "https://gitlab.com/libeigen/eigen/-/archive/3.4/eigen-3.4.zip?ref_type=heads"
85+ )
8186
8287 medi_name = "MeDiPack"
8388 codi_name = "CoDiPack"
@@ -180,7 +185,11 @@ def init_submodules(
180185 )
181186 if own_eigen :
182187 download_module (
183- eigen_name , alt_name_eigen , github_repo_eigen , sha_version_eigen
188+ eigen_name ,
189+ alt_name_eigen ,
190+ github_repo_eigen ,
191+ sha_version_eigen ,
192+ download_eigen ,
184193 )
185194
186195
@@ -260,7 +269,7 @@ def submodule_status(path, sha_commit):
260269 )
261270
262271
263- def download_module (name , alt_name , git_repo , commit_sha ):
272+ def download_module (name , alt_name , git_repo , commit_sha , download_url = None ):
264273 # ZipFile does not preserve file permissions.
265274 # This is a workaround for that problem:
266275 # https://stackoverflow.com/questions/39296101/python-zipfile-removes-execute-permissions-from-binaries
@@ -296,7 +305,7 @@ def _extract_member(self, member, targetpath, pwd):
296305 alt_filename = name + "-" + filename
297306 alt_filepath = os .path .join (sys .path [0 ], alt_filename )
298307
299- url = git_repo + "/archive/" + filename
308+ url = download_url or ( git_repo + "/archive/" + filename )
300309
301310 if not os .path .exists (filepath ) and not os .path .exists (alt_filepath ):
302311 try :
@@ -321,7 +330,13 @@ def _extract_member(self, member, targetpath, pwd):
321330 if os .path .exists (alt_name ):
322331 os .rmdir (alt_name )
323332
324- os .rename (os .path .join (target_dir , name + "-" + commit_sha ), alt_name )
333+ try :
334+ os .rename (os .path .join (target_dir , name + "-" + commit_sha ), alt_name )
335+ except FileNotFoundError :
336+ if "eigen" in url :
337+ os .rename (os .path .join (target_dir , "eigen-3.4" ), alt_name )
338+ else :
339+ raise
325340
326341 # Delete zip file
327342 remove_file (filepath )
0 commit comments