def set_source_select(cls, rpath, tuplelist, *filelists): """Initialize select object using tuplelist Note that each list in filelists must each be passed as separate arguments, so each is recognized as a file by the connection. Otherwise we will get an error because a list containing files can't be pickled. Also, cls._source_select needs to be cached so get_diffs below can retrieve the necessary rps. """ sel = selection.Select(rpath) sel.ParseArgs(tuplelist, filelists) sel.set_iter() cache_size = Globals.pipeline_max_length * 3 # to and from+leeway cls._source_select = rorpiter.CacheIndexable(sel, cache_size) Globals.set('select_mirror', sel)
def set_resource_fork_readonly(self, dir_rp): """Test for resource fork support by testing an regular file Launches search for regular file in given directory. If no regular file is found, resource_fork support will be turned off by default. """ for rp in selection.Select(dir_rp).set_iter(): if rp.isreg(): try: rfork = rp.append(os.path.join('..namedfork', 'rsrc')) fp = rfork.open('rb') fp.read() assert not fp.close() except (OSError, IOError): self.resource_forks = 0 return self.resource_forks = 1 return self.resource_forks = 0
def get_iter_from_fs(): """Get the combined iterator from the filesystem""" sel = selection.Select(rpath) sel.parse_rbdir_exclude() return sel.set_iter()