Ejemplo n.º 1
0
 def __init__(self, distro, root_dir, instances, opts=None):
     self.distro = distro
     self.root_dir = root_dir
     self.instances = instances
     self.opts = opts or {}
     # Various paths we will use while operating
     self.deps_dir = sh.joinpths(self.root_dir, "deps")
     self.downloaded_flag_file = sh.joinpths(self.deps_dir, "pip-downloaded")
     self.download_dir = sh.joinpths(self.deps_dir, "download")
     self.log_dir = sh.joinpths(self.deps_dir, "output")
     self.gathered_requires_filename = sh.joinpths(self.deps_dir, "pip-requires")
     self.forced_requires_filename = sh.joinpths(self.deps_dir, "forced-requires")
     self.download_requires_filename = sh.joinpths(self.deps_dir, "download-requires")
     # Executables we require to operate
     self.multipip_executable = sh.which("multipip", ["tools/"])
     self.pip_executable = sh.which_first(['pip-python', 'pip'])
     self.pipdownload_executable = sh.which("pip-download", ["tools/"])
     # List of requirements
     self.pips_to_install = []
     self.forced_packages = []
     # Instances to there app directory (with a setup.py inside)
     self.package_dirs = self._get_package_dirs(instances)
     # Instantiate this as late as we can.
     self._python_names = None
     # Track what file we create so they can be cleaned up on uninstall.
     trace_fn = tr.trace_filename(self.root_dir, 'deps')
     self.tracewriter = tr.TraceWriter(trace_fn, break_if_there=False)
     self.tracereader = tr.TraceReader(trace_fn)
     self.requirements = {}
     for key in ("build-requires", "requires", "conflicts"):
         req_set = set()
         for inst in self.instances:
             req_set |= set(pkg["name"]
                            for pkg in inst.get_option(key) or [])
         self.requirements[key] = req_set
Ejemplo n.º 2
0
 def __init__(self, distro, root_dir, instances, opts=None):
     self.distro = distro
     self.root_dir = root_dir
     self.instances = instances
     self.opts = opts or {}
     # Various paths we will use while operating
     self.deps_dir = sh.joinpths(self.root_dir, "deps")
     self.downloaded_flag_file = sh.joinpths(self.deps_dir,
                                             "pip-downloaded")
     self.download_dir = sh.joinpths(self.deps_dir, "download")
     self.log_dir = sh.joinpths(self.deps_dir, "output")
     self.gathered_requires_filename = sh.joinpths(self.deps_dir,
                                                   "pip-requires")
     self.forced_requires_filename = sh.joinpths(self.deps_dir,
                                                 "forced-requires")
     self.download_requires_filename = sh.joinpths(self.deps_dir,
                                                   "download-requires")
     # Executables we require to operate
     self.multipip_executable = sh.which("multipip", ["tools/"])
     self.pip_executable = sh.which_first(['pip-python', 'pip'])
     self.pipdownload_executable = sh.which("pip-download", ["tools/"])
     # List of requirements
     self.pips_to_install = []
     self.forced_packages = []
     # Instances to there app directory (with a setup.py inside)
     self.package_dirs = self._get_package_dirs(instances)
     # Instantiate this as late as we can.
     self._python_names = None
     # Track what file we create so they can be cleaned up on uninstall.
     trace_fn = tr.trace_filename(self.root_dir, 'deps')
     self.tracewriter = tr.TraceWriter(trace_fn, break_if_there=False)
     self.tracereader = tr.TraceReader(trace_fn)
     self.requirements = {}
     for key in ("build-requires", "requires", "conflicts"):
         req_set = set()
         for inst in self.instances:
             req_set |= set(pkg["name"]
                            for pkg in inst.get_option(key) or [])
         self.requirements[key] = req_set
Ejemplo n.º 3
0
 def __init__(self):
     self._pip_executable = sh.which_first(['pip-python', 'pip'])
     self._installed_cache = None
Ejemplo n.º 4
0
import six

from anvil import log as logging
from anvil import shell as sh
from anvil import utils

LOG = logging.getLogger(__name__)

# Caches and there associated locks...
REQUIREMENT_FILE_CACHE = {}
REQUIREMENT_FILE_CACHE_LOCK = threading.RLock()
EGGS_DETAILED = {}
EGGS_DETAILED_LOCK = threading.RLock()

PYTHON_KEY_VERSION_RE = re.compile("^(.+)-([0-9][0-9.a-zA-Z]*)$")
PIP_EXECUTABLE = sh.which_first(['pip', 'pip-python'])


def create_requirement(name, version=None):
    name = pkg_resources.safe_name(name.strip())
    if not name:
        raise ValueError("Pip requirement provided with an empty name")
    if version is not None:
        if isinstance(version, (int, float, long)):
            version = "==%s" % version
        if isinstance(version, (str, basestring)):
            if version[0] not in "=<>":
                version = "==%s" % version
        else:
            raise TypeError(
                "Pip requirement version must be a string or numeric type")
Ejemplo n.º 5
0
 def __init__(self):
     self._pip_executable = sh.which_first(['pip-python', 'pip'])
     self._installed_cache = None
Ejemplo n.º 6
0
import six

from anvil import log as logging
from anvil import shell as sh
from anvil import utils

LOG = logging.getLogger(__name__)

# Caches and there associated locks...
REQUIREMENT_FILE_CACHE = {}
REQUIREMENT_FILE_CACHE_LOCK = threading.RLock()
EGGS_DETAILED = {}
EGGS_DETAILED_LOCK = threading.RLock()

PYTHON_KEY_VERSION_RE = re.compile("^(.+)-([0-9][0-9.a-zA-Z]*)$")
PIP_EXECUTABLE = sh.which_first(['pip', 'pip-python'])


def create_requirement(name, version=None):
    name = pkg_resources.safe_name(name.strip())
    if not name:
        raise ValueError("Pip requirement provided with an empty name")
    if version is not None:
        if isinstance(version, (int, float, long)):
            version = "==%s" % version
        if isinstance(version, (str, basestring)):
            if version[0] not in "=<>":
                version = "==%s" % version
        else:
            raise TypeError(
                "Pip requirement version must be a string or numeric type")