Esempio n. 1
0
 def installed_packages(self):
     """List of all packages that are installed in this environment."""
     pkgs = [] #: [(name, ver), ..]
     l = self._execute([self._pip_rpath, 'freeze', '-l']).split(linesep)
     for p in l:
         if p == '': continue
         pkgs.append(split_package_name(p))
     return pkgs
Esempio n. 2
0
 def installed_packages(self):
     """List of all packages that are installed in this environment."""
     pkgs = []  #: [(name, ver), ..]
     l = self._execute([self._pip_rpath, 'freeze', '-l']).split(linesep)
     for p in l:
         if p == '': continue
         pkgs.append(split_package_name(p))
     return pkgs
Esempio n. 3
0
 def is_installed(self, package):
     """Returns True if the given package (given in pip's package syntax)
     is installed in the virtual environment."""
     if package.endswith('.git'):
         pkg_name = os.path.split(package)[1][:-4]
         return pkg_name in self.installed_package_names
     pkg_tuple = split_package_name(package)
     if pkg_tuple[1] is not None:
         return pkg_tuple in self.installed_packages
     else:
         return pkg_tuple[0] in self.installed_package_names
Esempio n. 4
0
 def is_installed(self, package):
     """Returns True if the given package (given in pip's package syntax)
     is installed in the virtual environment."""
     if package.endswith('.git'):
         pkg_name = os.path.split(package)[1][:-4]
         return pkg_name in self.installed_package_names
     pkg_tuple = split_package_name(package)
     if pkg_tuple[1] is not None:
         return pkg_tuple in self.installed_packages
     else:
         return pkg_tuple[0] in self.installed_package_names
Esempio n. 5
0
 def is_installed(self, package):
     """Returns True if the given package (given in pip's package syntax or a
     tuple of ('name', 'ver')) is installed in the virtual environment."""
     if isinstance(package, tuple):
         package = '=='.join(package)
     if package.endswith('.git'):
         pkg_name = os.path.split(package)[1][:-4]
         return pkg_name in self.installed_package_names or \
                 pkg_name.replace('_', '-') in self.installed_package_names
     pkg_tuple = split_package_name(package)
     if pkg_tuple[1] is not None:
         return pkg_tuple in self.installed_packages
     else:
         return pkg_tuple[0].lower() in self.installed_package_names
Esempio n. 6
0
 def is_installed(self, package):
     """Returns True if the given package (given in pip's package syntax or a
     tuple of ('name', 'ver')) is installed in the virtual environment."""
     if isinstance(package, tuple):
         package = '=='.join(package)
     if package.endswith('.git'):
         pkg_name = os.path.split(package)[1][:-4]
         return pkg_name in self.installed_package_names or \
                 pkg_name.replace('_', '-') in self.installed_package_names
     pkg_tuple = split_package_name(package)
     if pkg_tuple[1] is not None:
         return pkg_tuple in self.installed_packages
     else:
         return pkg_tuple[0] in self.installed_package_names
Esempio n. 7
0
    def is_installed(self, package):
        """Returns True if the given package (given in pip's package syntax)
        is installed in the virtual environment."""
        if isinstance(package, list):
            for n in package:
                if not self.is_installed(n):
                    return False
            return True
        if isinstance(package, tuple):
            package = '=='.join(package)

        package = package.lower()

        if package.endswith('.git'):
            pkg_name = os.path.split(package)[1][:-4]
            return pkg_name in self.installed_package_names
        pkg_tuple = split_package_name(package)
        if pkg_tuple[1] is not None:
            return pkg_tuple in self.installed_packages
        else:
            return pkg_tuple[0] in self.installed_package_names