--- /dev/null
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python{2_7,3_4,3_5} )
+
+inherit distutils-r1 gnome2-utils xdg
+
+DESCRIPTION="GUI test tool and automation framework using accessibility framework"
+HOMEPAGE="https://gitlab.com/dogtail/dogtail/commits/master"
+SRC_URI="https://gitlab.com/${PN}/${PN}/raw/released/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND="
+ dev-libs/gobject-introspection
+ dev-python/pyatspi[${PYTHON_USEDEP}]
+ dev-python/pycairo[${PYTHON_USEDEP}]
+ dev-python/pygobject:3[${PYTHON_USEDEP}]
+ dev-python/pillow[${PYTHON_USEDEP}]
+ x11-libs/gdk-pixbuf:2[introspection]
+ x11-libs/gtk+:3[introspection]
+ x11-libs/libwnck:3[introspection]
+ x11-base/xorg-server[xvfb]
+ x11-apps/xinit
+"
+DEPEND="${DEPEND}
+ dev-python/setuptools[${PYTHON_USEDEP}]
+"
+
+src_prepare() {
+ # Install docs in one place
+ sed "s:doc/${PN}:doc/${PF}:" -i setup.py || die
+
+ # Upstream loads resources relative to __file__, which doesn't work with
+ # gentoo's dev-lang/python-exec. So we need to add hard-coded paths.
+ eapply "${FILESDIR}"/${PN}-0.9.10-gentoo-paths.patch
+ sed -e "s:@EPREFIX_USR@:'${EPREFIX}/usr':" -i sniff/sniff || die "sed failed"
+
+ xdg_src_prepare
+ distutils-r1_src_prepare
+}
+
+pkg_preinst() {
+ xdg_pkg_preinst
+ gnome2_icon_savelist
+}
+
+pkg_postinst() {
+ xdg_pkg_postinst
+ gnome2_icon_cache_update
+}
+
+pkg_postrm() {
+ xdg_pkg_postrm
+ gnome2_icon_cache_update
+}
--- /dev/null
+From d0dd6c6adb4edcd5147c42af14cd1016a67e84bd Mon Sep 17 00:00:00 2001
+From: Gilles Dartiguelongue <eva@gentoo.org>
+Date: Sat, 12 Aug 2017 00:59:44 +0200
+Subject: [PATCH] Load resources from well-known location
+
+Using __file__ does not work with Gentoo's dev-python/python-exec
+wrapping. Better use hard-coded paths.
+
+Also adds support for prefix.
+---
+ sniff/sniff | 29 +++++++++--------------------
+ 1 file changed, 9 insertions(+), 20 deletions(-)
+
+diff --git a/sniff/sniff b/sniff/sniff
+index 7ce67c7..84f7022 100755
+--- a/sniff/sniff
++++ b/sniff/sniff
+@@ -47,25 +47,18 @@ class SniffApp(object):
+ if os.path.exists('sniff.ui'):
+ self.builder.add_from_file('sniff.ui')
+ else:
+- import os
+- path = os.path.abspath(
+- os.path.join(__file__, os.path.pardir, os.path.pardir))
+- if path == '/': # in case the path is /bin/sniff
+- path = '/usr'
+- self.builder.add_from_file(path + '/share/dogtail/glade/sniff.ui')
++ self.builder.add_from_file(os.path.join(
++ @EPREFIX_USR@,
++ 'share/dogtail/glade/sniff.ui')
++ )
+ self.app = self.builder.get_object(self.appName)
+ try:
+ self.app.set_icon_from_file('../icons/dogtail-head.svg')
+ except Exception:
+- import os
+- path = os.path.abspath(
+- os.path.join(__file__, os.path.pardir, os.path.pardir))
+- if path is '/':
+- path = '/usr'
+- try:
+- self.app.set_icon_from_file(os.path.join(path, 'share/icons/hicolor/scalable/apps/dogtail-head.svg'))
+- except Exception: # fallback for wierd installations, when sniff is neither in /bin or /usr/bin
+- self.app.set_icon_from_file('/usr/share/icons/hicolor/scalable/apps/dogtail-head.svg')
++ self.app.set_icon_from_file(os.path.join(
++ @EPREFIX_USR@,
++ 'share/icons/hicolor/scalable/apps/dogtail-head.svg')
++ )
+ self.setUpWidgets()
+ self.connectSignals()
+ self.app.show_all()
+@@ -656,11 +649,7 @@ def loadIcon(iconName):
+ pixbuf = GdkPixbuf.Pixbuf.new_from_file('icons/' + iconName)
+ except GObject.GError:
+ import os
+- path = os.path.abspath(
+- os.path.join(__file__, os.path.pardir, os.path.pardir))
+- if path == '/':
+- path = '/usr'
+- iconName = os.path.join(path, 'share/dogtail/icons/', iconName)
++ iconName = os.path.join(@EPREFIX_USR@, 'share/dogtail/icons/', iconName)
+ pixbuf = GdkPixbuf.Pixbuf.new_from_file(iconName)
+ return pixbuf
+
+--
+2.14.0
+