예제 #1
0
    def _strip_unreferenced_directories(entries):
        """Strip all directories that don't (in)directly contain any files.

        :param entries: List of path strings or (path, ie) tuples to process
        """
        directories = []
        for entry in entries:
            if isinstance(entry, basestring):
                path = entry
            else:
                path = entry[0]
            if not path or path[-1] == "/":
                # directory
                directories.append((path, entry))
            else:
                # Yield the referenced parent directories
                for dirpath, direntry in directories:
                    if osutils.is_inside(dirpath, path):
                        yield direntry
                directories = []
                yield entry
예제 #2
0
    def _strip_unreferenced_directories(entries):
        """Strip all directories that don't (in)directly contain any files.

        :param entries: List of path strings or (path, ie) tuples to process
        """
        directories = []
        for entry in entries:
            if isinstance(entry, basestring):
                path = entry
            else:
                path = entry[0]
            if not path or path[-1] == "/":
                # directory
                directories.append((path, entry))
            else:
                # Yield the referenced parent directories
                for dirpath, direntry in directories:
                    if osutils.is_inside(dirpath, path):
                        yield direntry
                directories = []
                yield entry
예제 #3
0
 def _ensure_in_jail(self, test_case, path):
     jail_root = self._get_jail_root(test_case)
     if not osutils.is_inside(jail_root, osutils.normalizepath(path)):
         raise ValueError('%s is not inside %s' % (path, jail_root))
예제 #4
0
파일: script.py 프로젝트: Distrotech/bzr
 def _ensure_in_jail(self, test_case, path):
     jail_root = self._get_jail_root(test_case)
     if not osutils.is_inside(jail_root, osutils.normalizepath(path)):
         raise ValueError('%s is not inside %s' % (path, jail_root))