src/eric7/PipInterface/Pip.py

branch
eric7
changeset 9578
bbe0a4b0832e
parent 9482
a2bc06a54d9d
child 9580
123a7eadc798
equal deleted inserted replaced
9577:a0600d883f9e 9578:bbe0a4b0832e
673 ) 673 )
674 674
675 return packages 675 return packages
676 676
677 def getOutdatedPackages( 677 def getOutdatedPackages(
678 self, envName, localPackages=True, notRequired=False, usersite=False 678 self, envName, localPackages=True, notRequired=False, usersite=False,
679 interpreter=None
679 ): 680 ):
680 """ 681 """
681 Public method to get the list of outdated packages. 682 Public method to get the list of outdated packages.
682 683
683 @param envName name of the environment to get the packages for 684 @param envName name of the environment to get the packages for
684 @type str 685 @type str
685 @param localPackages flag indicating to get local packages only 686 @param localPackages flag indicating to get local packages only
686 @type bool 687 (defaults to False)
688 @type bool (optional)
687 @param notRequired flag indicating to list packages that are not 689 @param notRequired flag indicating to list packages that are not
688 dependencies of installed packages as well 690 dependencies of installed packages as well (defaults to False)
689 @type bool 691 @type bool (optional)
690 @param usersite flag indicating to only list packages installed 692 @param usersite flag indicating to only list packages installed
691 in user-site 693 in user-site (defaults to False)
692 @type bool 694 @type bool (optional)
695 @param interpreter path of an interpreter executable. If this is not
696 None, it will override the given environment name (defaults to None)
697 @type str (optional)
693 @return list of tuples containing the package name, installed version 698 @return list of tuples containing the package name, installed version
694 and available version 699 and available version
695 @rtype list of tuple of (str, str, str) 700 @rtype list of tuple of (str, str, str)
696 """ 701 """
697 packages = [] 702 packages = []
698 703
699 if envName: 704 if envName:
700 interpreter = self.getVirtualenvInterpreter(envName) 705 if interpreter is None:
706 interpreter = self.getVirtualenvInterpreter(envName)
701 if interpreter: 707 if interpreter:
702 args = [ 708 args = [
703 "-m", 709 "-m",
704 "pip", 710 "pip",
705 "list", 711 "list",
744 ) 750 )
745 ) 751 )
746 752
747 return packages 753 return packages
748 754
749 def checkPackageOutdated(self, packageStart, envName): 755 def checkPackageOutdated(self, packageStart, envName, interpreter=None):
750 """ 756 """
751 Public method to check, if a group of packages is outdated. 757 Public method to check, if a group of packages is outdated.
752 758
753 @param packageStart start string for package names to be checked 759 @param packageStart start string for package names to be checked
754 (case insensitive) 760 (case insensitive)
755 @type str 761 @type str
756 @param envName name of the environment to get the packages for 762 @param envName name of the environment to get the packages for
757 @type str 763 @type str
764 @param interpreter path of an interpreter executable. If this is not
765 None, it will override the given environment name (defaults to None)
766 @type str (optional)
758 @return tuple containing a flag indicating outdated packages and the 767 @return tuple containing a flag indicating outdated packages and the
759 list of tuples containing the package name, installed version 768 list of tuples containing the package name, installed version
760 and available version 769 and available version
761 @rtype tuple of (bool, (str, str, str)) 770 @rtype tuple of (bool, (str, str, str))
762 """ 771 """
763 filteredPackages = [] 772 filteredPackages = []
764 773
765 if bool(envName) and bool(packageStart): 774 if bool(envName) and bool(packageStart):
766 packages = self.getOutdatedPackages(envName) 775 packages = self.getOutdatedPackages(envName, interpreter=interpreter)
767 filterStr = packageStart.lower() 776 filterStr = packageStart.lower()
768 filteredPackages = [ 777 filteredPackages = [
769 p for p in packages if p[0].lower().startswith(filterStr) 778 p for p in packages if p[0].lower().startswith(filterStr)
770 ] 779 ]
771 780

eric ide

mercurial