aptdaemon might not always be awailable
This commit is contained in:
		
							parent
							
								
									479057b7f5
								
							
						
					
					
						commit
						8f705ab8bc
					
				
					 1 changed files with 7 additions and 3 deletions
				
			
		
							
								
								
									
										10
									
								
								argos-apt.py
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								argos-apt.py
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -11,7 +11,6 @@
 | 
			
		|||
# <bitbar.dependencies>python,aptdaemon,apt</bitbar.dependencies>
 | 
			
		||||
# <bitbar.abouturl>https://github.com/schtobia/argos-httping/blob/master/httping.py</bitbar.abouturl>
 | 
			
		||||
 | 
			
		||||
from aptdaemon import client
 | 
			
		||||
from apt import Cache
 | 
			
		||||
import sys
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -28,8 +27,13 @@ class Themes:
 | 
			
		|||
    original = ["#acacac","#ff0101","#cc673b","#ce8458","#6bbb15","#0ed812"]
 | 
			
		||||
    selected_colors = red_green
 | 
			
		||||
 | 
			
		||||
apt_client = client.AptClient()
 | 
			
		||||
apt_client.update_cache(wait=True)
 | 
			
		||||
try:
 | 
			
		||||
    from aptdaemon import client
 | 
			
		||||
    apt_client = client.AptClient()
 | 
			
		||||
    apt_client.update_cache(wait=True)
 | 
			
		||||
except ImportError as err:
 | 
			
		||||
    print(str(err), file=sys.stderr)
 | 
			
		||||
 | 
			
		||||
cache = Cache()
 | 
			
		||||
cache.open()
 | 
			
		||||
update_list = [pkg for pkg in cache if pkg.is_upgradable]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue