示例#1
0
def is_localised(pkg):
    if localz:
        root = util.normpath(pkg.root)
        path = util.normpath(localz.localized_packages_path())
        return root.startswith(path)
    else:
        return False
示例#2
0
    def _package_paths(self):
        """Return all package paths, relative the current state of the world"""

        paths = util.normpaths(*rez.config.packages_path)

        # Optional development packages
        if not self._state.retrieve("useDevelopmentPackages"):
            paths = util.normpaths(*rez.config.nonlocal_packages_path)

        # Optional package localisation
        if localz and not self._state.retrieve("useLocalizedPackages", True):
            path = localz.localized_packages_path()

            try:
                paths.remove(util.normpath(path))
            except ValueError:
                # It may not be part of the path
                pass

        return paths
示例#3
0
        def do():
            self.debug("Resolving %s.." % name)
            variant = localz.resolve(name)[0]  # Guaranteed to be one

            try:
                self.debug("Preparing %s.." % name)
                copied = localz.prepare(variant, tempdir, verbose=2)[0]

                self.debug("Computing size..")
                size = localz.dirsize(tempdir) / (10.0**6)  # mb

                self.debug("Localising %.2f mb.." % size)
                result = localz.localize(copied,
                                         localz.localized_packages_path(),
                                         verbose=2)

                self.debug("Localised %s" % result)

            finally:
                self.debug("Cleaning up..")
                shutil.rmtree(tempdir)