def _setup_dist(cmd, dist, install_needed=False, add_to_global=False): if install_needed: with cmdline.TempDir() as tmpdir: dist = cmd.install_egg(dist.location, tmpdir) if dist.location.startswith(pyenv.get_site_packages()): fix_permissions(dist) cmd.process_distribution(None, dist, deps=False) # Add the distributions to the global registry if we asked for it. # This makes the distro importable, and classed as 'already # installed' by the dependency resolution algorithm. if add_to_global: dependency.remove_from_ws(pkg_resources.working_set, dist) pkg_resources.working_set.add(dist) return dist
def get_site_packages(self): """ Returns the site-packages dir for this virtualenv """ from pkglib import pyenv return pyenv.get_site_packages()