@@ -142,7 +142,7 @@ def setup(
142142 config_table = Table (show_header = False )
143143 config_table .add_column ("Setting" , style = "cyan" )
144144 config_table .add_column ("Value" )
145-
145+
146146 config_table .add_row ("SDK Root" , str (sdk_root ))
147147 config_table .add_row ("API Level" , str (api ))
148148 config_table .add_row ("Target" , target )
@@ -155,12 +155,16 @@ def setup(
155155 if create_avd :
156156 config_table .add_row ("AVD" , create_avd )
157157 config_table .add_row ("Dry Run" , "Yes" if dry_run else "No" )
158-
158+
159159 console .print (config_table )
160160 console .print ()
161161
162162 # Run installation
163- with console .status ("[bold green]Installing Android tools..." ) if not verbose else nullcontext ():
163+ with (
164+ console .status ("[bold green]Installing Android tools..." )
165+ if not verbose
166+ else nullcontext ()
167+ ):
164168 result = ensure_android_tools (
165169 sdk_root = sdk_root ,
166170 api = api ,
@@ -185,7 +189,7 @@ def setup(
185189 sdk_root = result ["sdk_root" ],
186190 ndk_path = result ["ndk_path" ],
187191 )
188-
192+
189193 if export_env and verbose :
190194 console .print (f"[green]✓[/green] Environment exported to: { export_env } " )
191195
@@ -208,6 +212,7 @@ def setup(
208212 console .print (f"[bold red]Unexpected error:[/bold red] { e } " )
209213 if verbose :
210214 import traceback
215+
211216 traceback .print_exc ()
212217 sys .exit (1 )
213218
@@ -236,43 +241,43 @@ def verify(
236241 """
237242 try :
238243 console .print (f"[cyan]Verifying installation at: { sdk_root } [/cyan]\n " )
239-
244+
240245 status = verify_installation (sdk_root , verbose = verbose )
241-
246+
242247 # Create status table
243248 table = Table (title = "Installation Status" )
244249 table .add_column ("Component" , style = "cyan" )
245250 table .add_column ("Status" , style = "green" )
246251 table .add_column ("Details" )
247-
252+
248253 # SDK root
249254 table .add_row (
250255 "SDK Root" ,
251256 "✓" if status ["sdk_root_exists" ] else "✗" ,
252257 str (sdk_root ) if status ["sdk_root_exists" ] else "Not found" ,
253258 )
254-
259+
255260 # Command-line tools
256261 table .add_row (
257262 "Command-line Tools" ,
258263 "✓" if status ["cmdline_tools" ] else "✗" ,
259264 "Installed" if status ["cmdline_tools" ] else "Not installed" ,
260265 )
261-
266+
262267 # Platform tools
263268 table .add_row (
264269 "Platform Tools" ,
265270 "✓" if status ["platform_tools" ] else "✗" ,
266271 "Installed" if status ["platform_tools" ] else "Not installed" ,
267272 )
268-
273+
269274 # Emulator
270275 table .add_row (
271276 "Emulator" ,
272277 "✓" if status ["emulator" ] else "✗" ,
273278 "Installed" if status ["emulator" ] else "Not installed" ,
274279 )
275-
280+
276281 # NDK
277282 ndk_details = "Not installed"
278283 if status ["ndk" ] and status .get ("ndk_versions" ):
@@ -282,7 +287,7 @@ def verify(
282287 "✓" if status ["ndk" ] else "✗" ,
283288 ndk_details ,
284289 )
285-
290+
286291 # AVDs
287292 avd_details = "None"
288293 if status .get ("avds" ):
@@ -292,19 +297,19 @@ def verify(
292297 "✓" if status .get ("avds" ) else "-" ,
293298 avd_details ,
294299 )
295-
300+
296301 console .print (table )
297-
302+
298303 # Show installed components if verbose
299304 if verbose and status .get ("components" ):
300305 console .print ("\n [bold]Installed Components:[/bold]" )
301306 for component in status ["components" ]:
302307 console .print (f" • { component } " )
303-
308+
304309 # Exit code based on status
305310 if not status ["sdk_root_exists" ]:
306311 sys .exit (1 )
307-
312+
308313 except Exception as e :
309314 console .print (f"[bold red]Error:[/bold red] { e } " )
310315 sys .exit (1 )
@@ -317,9 +322,9 @@ def list_targets() -> None:
317322 Shows all supported combinations for system images.
318323 """
319324 from .plan import Planner
320-
325+
321326 console .print ("[bold]Supported System Image Combinations:[/bold]\n " )
322-
327+
323328 # Group by API level
324329 combinations : Dict [int , Dict [str , list ]] = {}
325330 for api , target , arch in Planner .VALID_COMBINATIONS :
@@ -328,29 +333,31 @@ def list_targets() -> None:
328333 if target not in combinations [api ]:
329334 combinations [api ][target ] = []
330335 combinations [api ][target ].append (arch )
331-
336+
332337 # Display as table
333338 for api in sorted (combinations .keys (), reverse = True ):
334339 table = Table (title = f"API Level { api } " )
335340 table .add_column ("Target" , style = "cyan" )
336341 table .add_column ("Architectures" )
337-
342+
338343 for target in sorted (combinations [api ].keys ()):
339344 archs = ", " .join (sorted (combinations [api ][target ]))
340345 table .add_row (target , archs )
341-
346+
342347 console .print (table )
343348 console .print ()
344349
345350
346351# Context manager for when console status is not needed
347352class nullcontext :
348353 """Null context manager."""
354+
349355 def __enter__ (self ):
350356 return self
357+
351358 def __exit__ (self , * args ):
352359 pass
353360
354361
355362if __name__ == "__main__" :
356- app ()
363+ app ()
0 commit comments