commit:     96c5b51c3554d8bf6aa703eb70b8e919742dba43
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 20 10:19:56 2018 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Tue Feb 20 10:20:08 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=96c5b51c

dev-python/pyxattr: Fixed compilation against >=sys-apps/attr-2.4.48

Permission kindly granted by robbat2

Bug: https://bugs.gentoo.org/644060
Package-Manager: Portage-2.3.24, Repoman-2.3.6

 .../pyxattr/files/pyxattr-0.6.0-xattr_header.patch | 53 +++++++++++++++++++
 dev-python/pyxattr/pyxattr-0.6.0-r1.ebuild         | 59 ++++++++++++++++++++++
 2 files changed, 112 insertions(+)

diff --git a/dev-python/pyxattr/files/pyxattr-0.6.0-xattr_header.patch 
b/dev-python/pyxattr/files/pyxattr-0.6.0-xattr_header.patch
new file mode 100644
index 00000000000..89b18730c3d
--- /dev/null
+++ b/dev-python/pyxattr/files/pyxattr-0.6.0-xattr_header.patch
@@ -0,0 +1,53 @@
+From cc0bc63b291ee1a831f07c81946149dbe8c8146d Mon Sep 17 00:00:00 2001
+From: Lars Wendler <polynomia...@gentoo.org>
+Date: Wed, 10 Jan 2018 11:45:35 +0100
+Subject: [PATCH] xattr.c: There is no more attr/xattr.h with >=attr-2.4.48
+
+See also:
+http://git.savannah.nongnu.org/cgit/attr.git/commit/?id=7921157890d07858d092f4003ca4c6bae9fd2c38
+---
+ xattr.c | 13 +++----------
+ 1 file changed, 3 insertions(+), 10 deletions(-)
+
+diff --git a/xattr.c b/xattr.c
+index 111cec1..c82ee32 100644
+--- a/xattr.c
++++ b/xattr.c
+@@ -23,10 +23,8 @@
+ 
+ #define PY_SSIZE_T_CLEAN
+ #include <Python.h>
+-#if defined(__APPLE__)
++#if defined(__APPLE__) || defined(__linux__)
+ #include <sys/xattr.h>
+-#elif defined(__linux__)
+-#include <attr/xattr.h>
+ #endif
+ #include <stdio.h>
+ 
+@@ -642,11 +640,7 @@ get_all(PyObject *self, PyObject *args, PyObject *keywds)
+         /* Now retrieve the attribute value */
+         nval = _generic_get(_get_obj, &tgt, s, &buf_val, &nalloc, &io_errno);
+         if (nval == -1) {
+-          if (
+-#ifdef ENODATA
+-              io_errno == ENODATA ||
+-#endif
+-              io_errno == ENOATTR) {
++          if (io_errno == ENODATA) {
+             PyErr_Clear();
+             continue;
+           } else {
+@@ -1173,8 +1167,7 @@ static char __xattr_doc__[] = \
+     "   a :exc:`EnvironmentError`; under\n"
+     "   Linux, the following ``errno`` values are used:\n"
+     "\n"
+-    "   - ``ENOATTR`` and ``ENODATA`` mean that the attribute name is\n"
+-    "     invalid\n"
++    "   - ``ENODATA`` means that the attribute name is\n invalid\n"
+     "   - ``ENOTSUP`` and ``EOPNOTSUPP`` mean that the filesystem does not\n"
+     "     support extended attributes, or that the namespace is invalid\n"
+     "   - ``E2BIG`` mean that the attribute value is too big\n"
+-- 
+2.16.0.rc1
+

diff --git a/dev-python/pyxattr/pyxattr-0.6.0-r1.ebuild 
b/dev-python/pyxattr/pyxattr-0.6.0-r1.ebuild
new file mode 100644
index 00000000000..02c1ec7d781
--- /dev/null
+++ b/dev-python/pyxattr/pyxattr-0.6.0-r1.ebuild
@@ -0,0 +1,59 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+PYTHON_COMPAT=( python2_7 python3_{4,5,6} pypy )
+
+inherit distutils-r1 eutils
+
+DESCRIPTION="Python interface to xattr"
+HOMEPAGE="http://pyxattr.k1024.org/";
+SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz
+       http://pyxattr.k1024.org/downloads/${P}.tar.gz";
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 
~sh ~sparc ~x86 ~amd64-linux ~arm-linux ~x86-linux"
+IUSE="doc test"
+
+RDEPEND="sys-apps/attr"
+DEPEND="${RDEPEND}
+       dev-python/setuptools[${PYTHON_USEDEP}]
+       doc? ( >=dev-python/sphinx-1.3.1[${PYTHON_USEDEP}] )
+       test? ( dev-python/nose[${PYTHON_USEDEP}] )"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-0.6.0-xattr_header.patch"
+)
+
+python_prepare_all() {
+       sed -i -e 's:, "-Werror"::' setup.py || die
+       # Bug 548486
+       sed -e "s:html_theme = 'default':html_theme = 'classic':" \
+               -i doc/conf.py || die
+
+       distutils-r1_python_prepare_all
+}
+
+python_compile_all() {
+       use doc && emake doc
+}
+
+src_test() {
+       # Perform the tests in /var/tmp; that location is more likely
+       # to have xattr support than /tmp which is often tmpfs.
+       export TESTDIR=/var/tmp
+
+       einfo 'Please note that the tests fail if xattrs are not supported'
+       einfo 'by the filesystem used for /var/tmp.'
+       distutils-r1_src_test
+}
+
+python_test() {
+       nosetests || die "Tests fail with ${EPYTHON}"
+}
+
+python_install_all() {
+       use doc && local HTML_DOCS=( doc/html/. )
+       distutils-r1_python_install_all
+}

Reply via email to