mirror of
				https://github.com/brain-hackers/wiki.brainux.org
				synced 2025-11-04 22:48:38 +09:00 
			
		
		
		
	Add package_list.py
This commit is contained in:
		
							
								
								
									
										22
									
								
								tools/package_list.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								tools/package_list.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
				
			|||||||
 | 
					import requests
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					res = requests.get('https://raw.githubusercontent.com/brain-hackers/buildbrain/master/os-brainux/setup_brainux.sh')
 | 
				
			||||||
 | 
					lines = res.text.split('\n')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					found_packages = []
 | 
				
			||||||
 | 
					backslashed = False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					for (i,line) in enumerate(lines):       
 | 
				
			||||||
 | 
					    if line.strip().startswith('apt install') or backslashed:
 | 
				
			||||||
 | 
					        if backslashed:
 | 
				
			||||||
 | 
					            packages = line.strip().split(' ')
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
 | 
					            packages = line.strip().split(' ')[2:]
 | 
				
			||||||
 | 
					        packages = [p for p in packages if not p.startswith('-')]
 | 
				
			||||||
 | 
					        packages = [p for p in packages if not p == '\\']
 | 
				
			||||||
 | 
					        packages = [p.rstrip('\\') for p in packages]
 | 
				
			||||||
 | 
					        found_packages.extend(packages)
 | 
				
			||||||
 | 
					        backslashed = line.endswith('\\')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					print('\n'.join(found_packages))
 | 
				
			||||||
		Reference in New Issue
	
	Block a user