예제 #1
0
 def _volatile(self):
     """
     Return the list of volatile (i.e. temporary or obsolete) directories.
     """
     _list = []
     for name in _directory_contents("%s/%s" % (self.path, TEMPORARY_DIRECTORY), True):
         if _ELEMENT_REGEXP.match(name):
             _list.append("%s/%s" % (TEMPORARY_DIRECTORY, name))
     for name in _directory_contents("%s/%s" % (self.path, OBSOLETE_DIRECTORY), True):
         if _ELEMENT_REGEXP.match(name):
             _list.append("%s/%s" % (OBSOLETE_DIRECTORY, name))
     return _list
예제 #2
0
 def _volatile(self):
     """
     Return the list of volatile (i.e. temporary or obsolete) directories.
     """
     _list = []
     for name in _directory_contents(
             '%s/%s' % (self.path, TEMPORARY_DIRECTORY), True):
         if _ELEMENT_REGEXP.match(name):
             _list.append('%s/%s' % (TEMPORARY_DIRECTORY, name))
     for name in _directory_contents(
             '%s/%s' % (self.path, OBSOLETE_DIRECTORY), True):
         if _ELEMENT_REGEXP.match(name):
             _list.append('%s/%s' % (OBSOLETE_DIRECTORY, name))
     return _list
예제 #3
0
 def _build_elements(self):
     _list = []
     while self.dirs:
         _dir = self.dirs.pop(0)
         for name in os.listdir('%s/%s' % (self.path, _dir)):
             if _ELEMENT_REGEXP.match(name):
                 _list.append(name)
         if not _list:
             continue
         _list.sort()
         self.elts = ['%s/%s' % (_dir, x) for x in _list]
         return True
     return False
예제 #4
0
 def count(self):
     """Return the number of elements in the queue, locked or not
     (but not temporary).
     """
     count = 0
     # get list of intermediate directories
     dirs = []
     self.__get_list_of_interm_dirs(dirs)
     # count elements in sub-directories
     for name in dirs:
         for element in os.listdir('%s/%s' % (self.path, name)):
             if _ELEMENT_REGEXP.match(element):
                 count += 1
     return count
예제 #5
0
    def _build_elements(self):
        """Build list of elements.

        Raise:
            OSError - can't list element directories
        """
        while self.dirs:
            directory = self.dirs.pop(0)
            _list = []
            for name in _directory_contents("%s/%s" % (self.path, directory), True):
                if _ELEMENT_REGEXP.match(name):
                    _list.append(name)
            if not _list:
                continue
            self.elts = ["%s/%s" % (directory, x) for x in sorted(_list)]
            return True
        return False
예제 #6
0
    def _build_elements(self):
        """Build list of elements.

        Raise:
            OSError - can't list element directories
        """
        while self.dirs:
            directory = self.dirs.pop(0)
            _list = []
            for name in _directory_contents(
                    '%s/%s' % (self.path, directory), True):
                if _ELEMENT_REGEXP.match(name):
                    _list.append(name)
            if not _list:
                continue
            self.elts = ['%s/%s' % (directory, x) for x in sorted(_list)]
            return True
        return False