@@ -15,7 +15,7 @@ def __init__(self, key: str, aliases: List[str]):
1515 self .key = key
1616 self .aliases = aliases
1717
18- def get_directory (self , tag : str ) -> str :
18+ def get_directory (self , tag : str ) -> Path :
1919 raise NotImplementedError ()
2020
2121 def install (self , tag : str , overwrite : bool ) -> None :
@@ -88,7 +88,7 @@ def is_installed(self, tag: str) -> bool:
8888 def _download (self , tag : str ):
8989 url = self ._get_download_url (tag )
9090 archive_path = self ._get_archive_path (tag )
91- downloader .download (url , archive_path )
91+ downloader .download (url , str ( archive_path ) )
9292
9393 def _extract (self , tag : str ):
9494 archive_path = self ._get_archive_path (tag )
@@ -101,26 +101,23 @@ def _extract(self, tag: str):
101101 else :
102102 raise errors .UnknownArchiveType (self .archive_type )
103103
104- def get_directory (self , tag : str ):
105- folder = path .join (self .get_parent_directory (), tag )
106- return folder
104+ def get_directory (self , tag : str ) -> Path :
105+ return config .get_dependency_directory (self .key , tag )
107106
108107 def get_source_directory (self , tag : str ):
109- folder = Path (self .get_directory (tag ))
110-
111108 # Due to how the GitHub creates archives for repository releases, the
112109 # path will contain the tag in two variants: with the 'v' prefix (e.g.
113110 # "v1.1.0"), but also without (e.g. "1.1.0"), hence the need to remove
114111 # the initial 'v'.
115- if tag .startswith ("v" ):
116- tag = tag [1 :]
112+ tag_no_v = tag
113+ if tag_no_v .startswith ("v" ):
114+ tag_no_v = tag_no_v [1 :]
117115 assert isinstance (self .repo_name , str )
118- source_folder = folder / ( self .repo_name + '-' + tag )
116+ source_folder = self . get_directory ( tag ) / f' { self .repo_name } - { tag_no_v } '
119117 return source_folder
120118
121- def get_parent_directory (self ):
122- tools_folder = workstation .get_tools_folder ()
123- return path .join (tools_folder , self .key )
119+ def get_parent_directory (self ) -> Path :
120+ return config .get_dependency_parent_directory (self .key )
124121
125122 def _get_download_url (self , tag : str ) -> str :
126123 platform = workstation .get_platform ()
@@ -140,9 +137,9 @@ def get_latest_release(self) -> str:
140137 tag = utils .query_latest_release_tag (org_repo )
141138 return tag
142139
143- def _get_archive_path (self , tag : str ) -> str :
144- tools_folder = workstation .get_tools_folder ()
145- archive = path . join ( tools_folder , f"{ self .key } .{ tag } .{ self .archive_type } " )
140+ def _get_archive_path (self , tag : str ) -> Path :
141+ tools_folder = Path ( workstation .get_tools_folder () )
142+ archive = tools_folder / f"{ self .key } .{ tag } .{ self .archive_type } "
146143 return archive
147144
148145
@@ -163,6 +160,7 @@ def _post_install(self, tag: str):
163160
164161 self .make_binary_symlink_in_parent_folder (tag , 'arwendebug' , 'arwendebug' )
165162 self .make_binary_symlink_in_parent_folder (tag , 'test' , 'mandos-test' )
163+ self .copy_libwasmer_in_parent_directory (tag )
166164
167165 def build_binary (self , tag , binary_name ):
168166 source_folder = self .binary_source_folder (tag , binary_name )
@@ -178,12 +176,19 @@ def make_binary_symlink_in_parent_folder(self, tag, binary_name, symlink_name):
178176 source_folder = self .binary_source_folder (tag , binary_name )
179177 binary = source_folder / binary_name
180178
181- parent = Path ( self .get_parent_directory () )
179+ parent = self .get_parent_directory ()
182180 symlink = parent / symlink_name
183181
184182 symlink .unlink (missing_ok = True )
185183 symlink .symlink_to (binary )
186184
185+ def copy_libwasmer_in_parent_directory (self , tag ):
186+ libwasmer_directory = self .get_source_directory (tag ) / 'wasmer'
187+ parent_directory = self .get_parent_directory ()
188+ for f in libwasmer_directory .iterdir ():
189+ if f .suffix in ['.dylib' , '.so' , '.dll' ]:
190+ shutil .copy (f , parent_directory )
191+
187192 def get_env (self ):
188193 return {
189194 }
0 commit comments