mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	tools: Add tool for listing outdated pip packages.
This commit is contained in:
		
							
								
								
									
										22
									
								
								tools/list-outdated-packages
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										22
									
								
								tools/list-outdated-packages
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,22 @@
 | 
			
		||||
#!/usr/bin/env python3
 | 
			
		||||
import subprocess
 | 
			
		||||
import os
 | 
			
		||||
 | 
			
		||||
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 | 
			
		||||
os.chdir(ZULIP_PATH)
 | 
			
		||||
 | 
			
		||||
output = subprocess.check_output(['pip', 'list', '--outdated', '--format',
 | 
			
		||||
                                  'columns']).decode('utf-8').splitlines()
 | 
			
		||||
 | 
			
		||||
packages_info = output[2:]
 | 
			
		||||
 | 
			
		||||
for package_line in packages_info:
 | 
			
		||||
    package_name = package_line.split()[0]
 | 
			
		||||
    package_current_version = package_line.split()[1]
 | 
			
		||||
    package_latest_version = package_line.split()[2]
 | 
			
		||||
    try:
 | 
			
		||||
        output = subprocess.check_output(['grep', '-r', package_name, 'requirements', '--exclude=*.txt',
 | 
			
		||||
                                          '--include=pip.txt']).decode('utf-8')
 | 
			
		||||
        print(package_name, "|", package_current_version, "|", package_latest_version)
 | 
			
		||||
    except subprocess.CalledProcessError:
 | 
			
		||||
        pass
 | 
			
		||||
		Reference in New Issue
	
	Block a user