def _query_xattr(cls, path, siz, syscall, *a): if siz: buf = gr_create_string_buffer(siz) else: buf = None ret = getattr(cls.libc, syscall)(*((path, ) + a + (buf, siz))) if ret == -1: cls.raise_oserr() if siz: # py2 and py3 compatibility. Convert bytes array # to string result = bytearray_to_str(buf.raw) return result[:ret] else: return ret
def cl_history_getchanges(cls): """ remove hardcoding for path name length """ def clsort(f): return f.split('.')[-1] changes = [] buf = gr_create_string_buffer(4096) call = cls._get_api('gf_history_changelog_next_change') while True: ret = call(buf, 4096) if ret in (0, -1): break # py2 and py3 compatibility result = bytearray_to_str(buf.raw[:ret - 1]) changes.append(result) if ret == -1: cls.raise_changelog_err() return sorted(changes, key=clsort)
def cl_getchanges(cls): """ remove hardcoding for path name length """ def clsort(f): return f.split('.')[-1] changes = [] buf = gr_create_string_buffer(4096) call = cls._get_api('gf_changelog_next_change') while True: ret = call(buf, 4096) if ret in (0, -1): break # py2 and py3 compatibility result = bytearray_to_str(buf.raw[:ret - 1]) changes.append(result) if ret == -1: cls.raise_changelog_err() # cleanup tracker cls.cl_startfresh() return sorted(changes, key=clsort)
def history_getchanges(): def clsort(cfile): return cfile.split('.')[-1] changes = [] buf = gr_create_string_buffer(4096) call = libgfc.gf_history_changelog_next_change while True: ret = call(buf, 4096) if ret in (0, -1): break # py2 and py3 compatibility result = bytearray_to_str(buf.raw[:ret - 1]) changes.append(result) if ret == -1: _raise_changelog_err() return sorted(changes, key=clsort)