@@ -100,7 +100,7 @@ def to_file(self, scoop_file: Path) -> None:
100100
101101
102102@dataclass
103- class InstalledApp :
103+ class InstalledScoopApp :
104104 #: App name
105105 name : str
106106 #: App version
@@ -111,6 +111,10 @@ class InstalledApp:
111111 bin_dirs : List [Path ]
112112 #: List of directories relative to the app path
113113 env_add_path : List [Path ]
114+ #: App scoop manifest file
115+ manifest_file : Path
116+ #: Environment variables defined in the manifest
117+ env_vars : Dict [str , Any ] = field (default_factory = dict )
114118
115119 def get_bin_paths (self ) -> List [Path ]:
116120 """Return the list of absolute bin paths."""
@@ -126,11 +130,9 @@ def get_all_required_paths(self) -> List[Path]:
126130 unique_paths = list (dict .fromkeys (all_paths ))
127131 return unique_paths
128132
129-
130- @dataclass
131- class InstalledScoopApp (InstalledApp ):
132- #: App scoop manifest file
133- manifest_file : Path
133+ def parse_env_vars (self , env_set : Dict [str , str ]) -> None :
134+ """Parse and populate environment variables from the manifest."""
135+ self .env_vars = {key : value .replace ("$dir" , str (self .path )) for key , value in env_set .items ()}
134136
135137
136138class ScoopWrapper :
@@ -202,14 +204,16 @@ def parse_manifest_file(self, manifest_file: Path) -> InstalledScoopApp:
202204 tool_version : str = manifest_data .get ("version" , None )
203205 bin_dirs : List [Path ] = self .parse_bin_dirs (manifest_data .get ("bin" , []))
204206 env_add_path : List [Path ] = self .parse_env_path_dirs (manifest_data .get ("env_add_path" , []))
205- return InstalledScoopApp (
207+ installed_app = InstalledScoopApp (
206208 name = tool_name ,
207209 version = tool_version ,
208210 path = app_directory ,
209211 manifest_file = manifest_file ,
210212 bin_dirs = bin_dirs ,
211213 env_add_path = env_add_path ,
212214 )
215+ installed_app .parse_env_vars (manifest_data .get ("env_set" , {}))
216+ return installed_app
213217
214218 def get_installed_apps (self ) -> List [InstalledScoopApp ]:
215219 installed_tools : List [InstalledScoopApp ] = []
0 commit comments