On 30 May 2015 11:14, Mike Frysinger wrote:
> Rather than each module implementing its own shim around the various
> methods for accessing extended attributes, start a dedicated module
> that exports a consistent API.

and it looks like i just missed the new pym/portage/util/xattr.py module.
i'll have to merge that in too.  but first about the API.

the current code does:
        import portage.util.xattr as _xattr
and then the _xattr module provides three functions:
        getxattr
        listxattr
        setxattr
which is kind of confusing as both pyxattr and python 3.3 (via the os module) 
provide these functions, but with different signatures.  for example:
        os.getxattr(path, attribute, follow_symlinks=True)
        xattr.getxattr(item, attribute[, nofollow=False])
i think this is why the pyxattr module has actually marked all of these as 
deprecated.

mine is:
        from portage.util._xattr import xattr
and then the xattr module provides the standard pyxattr functions:
        xattr.get
        xattr.get_all
        xattr.list
        xattr.remove
        xattr.set
and i omit all of the confusing variants.  the reason i don't put the functions 
into the module itself is so that we can more xattr related functions which i've
already done with the context manager:
        from portage.util._xattr import preserve_xattrs
        with preserve_xattrs('/some/file'):
                ...

so if there's no reason to keep portage.util.xattr, i'll kill it and move the 
new quickpkg usage to _xattr.
-mike

Attachment: signature.asc
Description: Digital signature

Reply via email to