src/eric7/PipInterface/Pip.py

branch
eric7
changeset 10156
e72868c86d84
parent 10084
125166c6b66c
child 10167
0a62a4bf749c
equal deleted inserted replaced
10155:722f018e5c08 10156:e72868c86d84
659 proc.readAllStandardOutput(), 659 proc.readAllStandardOutput(),
660 Preferences.getSystem("IOEncoding"), 660 Preferences.getSystem("IOEncoding"),
661 "replace", 661 "replace",
662 ) 662 )
663 .strip() 663 .strip()
664 .splitlines()[0]
665 ) 664 )
666 try: 665 if output:
667 jsonList = json.loads(output) 666 output = output.splitlines()[0]
668 except Exception: 667 try:
669 jsonList = [] 668 jsonList = json.loads(output)
670 669 except Exception:
671 for package in jsonList: 670 jsonList = []
672 if isinstance(package, dict): 671
673 packages.append( 672 for package in jsonList:
674 ( 673 if isinstance(package, dict):
675 package["name"], 674 packages.append(
676 package["version"], 675 (
676 package["name"],
677 package["version"],
678 )
677 ) 679 )
678 )
679 680
680 return packages 681 return packages
681 682
682 def getOutdatedPackages( 683 def getOutdatedPackages(
683 self, 684 self,
740 proc.readAllStandardOutput(), 741 proc.readAllStandardOutput(),
741 Preferences.getSystem("IOEncoding"), 742 Preferences.getSystem("IOEncoding"),
742 "replace", 743 "replace",
743 ) 744 )
744 .strip() 745 .strip()
745 .splitlines()[0]
746 ) 746 )
747 try: 747 if output:
748 jsonList = json.loads(output) 748 output = output.splitlines()[0]
749 except Exception: 749 try:
750 jsonList = [] 750 jsonList = json.loads(output)
751 751 except Exception:
752 for package in jsonList: 752 jsonList = []
753 if isinstance(package, dict): 753
754 packages.append( 754 for package in jsonList:
755 ( 755 if isinstance(package, dict):
756 package["name"], 756 packages.append(
757 package["version"], 757 (
758 package["latest_version"], 758 package["name"],
759 package["version"],
760 package["latest_version"],
761 )
759 ) 762 )
760 )
761 763
762 return packages 764 return packages
763 765
764 def checkPackagesOutdated(self, packageStarts, envName, interpreter=None): 766 def checkPackagesOutdated(self, packageStarts, envName, interpreter=None):
765 """ 767 """

eric ide

mercurial