def test_lock(self): apt_pkg.get_lock(self.file_unicode, True) apt_pkg.get_lock(self.file_bytes, True) with apt_pkg.FileLock(self.file_unicode): pass with apt_pkg.FileLock(self.file_bytes): pass
def update_index(self, ignore_errors=False): import apt.progress.base lists = apt_pkg.config.find_dir("Dir::State::Lists") with apt_pkg.FileLock(os.path.join(lists, "lock")): try: self.cache.update(apt.progress.base.AcquireProgress(), self.source_list) except apt_pkg.Error as e: if not ignore_errors: raise NewDataSource.DataError("Failed to update cache: {}".format(e))
def __init__(self, path): # type: (str) -> None self._path = path self._lock = apt_pkg.FileLock(os.path.join(path, "lock"))