# Copyright 1999-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 DISTUTILS_SINGLE_IMPL=1 DISTUTILS_USE_PEP517=setuptools PYTHON_COMPAT=( python3_{12..15} ) UVER= UREV= inherit distutils-r1 optfeature ubuntu-versionator DESCRIPTION="Extra scopes for the Unity Dash" HOMEPAGE="https://launchpad.net/onehundredscopes" S="${WORKDIR}/${P}" LICENSE="GPL-3" SLOT="0" KEYWORDS="amd64" RESTRICT="test" RDEPEND=" dev-libs/dee:0=[${PYTHON_SINGLE_USEDEP}] dev-libs/gobject-introspection dev-libs/libunity:0=[${PYTHON_SINGLE_USEDEP}] $(python_gen_cond_dep ' dev-python/pygobject:3[${PYTHON_USEDEP}] ') " BDEPEND=" virtual/pkgconfig $(python_gen_cond_dep ' dev-python/python-distutils-extra[${PYTHON_USEDEP}] ') " ## Neat and efficient way of bundling and tracking all available scopes into one ebuild ## ## Borrowed from chenxiaolong's Unity-for-Arch overlay at https://github.com/chenxiaolong/Unity-for-Arch ## setvar() { eval "_uver_${1}=${2}" eval "_urev_${1}=${3}" eval "_use_${1}=${4}" eval "_dep_${1}=\"${5}\"" packages+=( ${1} ) } #[fnc] [name] [UVER] [UREV] [IUSE] [RDEPEND] setvar audacious 0.1+13.10.20130927.1 0ubuntu1 + "$(python_gen_cond_dep 'dev-python/dbus-python[${PYTHON_USEDEP}] media-libs/mutagen[${PYTHON_USEDEP}]')" setvar calculator 0.1+14.04.20140328 0ubuntu6 + "" setvar chromiumbookmarks 0.1+13.10.20130723 0ubuntu1 + "" setvar devhelp 0.1+14.04.20140328 0ubuntu5 - "$(python_gen_cond_dep 'dev-python/lxml[${PYTHON_USEDEP}]')" setvar firefoxbookmarks 0.1+13.10.20130809.1 0ubuntu1 + "" setvar manpages 3.0+14.04.20140324 0ubuntu5 - "sys-apps/man-db x11-libs/gtk+:3" setvar texdoc 0.1+14.04.20140328 0ubuntu1 - "" setvar virtualbox 0.1+13.10.20130723 0ubuntu4 - "" ## Separate the columns with spaces only (no tabs) ## UURL="${UURL%/*}"; unset SRC_URI for i in ${packages[@]}; do eval "_name=${i}; _uver=\${_uver_${i}}; _urev=\${_urev_${i}}; _use=\${_use_${i}}; _dep=\${_dep_${i}}" [[ -n ${_dep} ]] && RDEPEND+=" ${_name}? ( ${_dep} )" IUSE+="${_use/-}${_name} " SRC_URI+="${_name}? ( ${UURL}/unity-scope-${_name}_${_uver}.orig.tar.gz ${UURL}/unity-scope-${_name}_${_uver}-${_urev}.diff.gz ) " done PDEPEND="audacious? ( unity-lens/unity-lens-meta[music] )" src_unpack() { # Keep distutils-r1 build directory inside WORKDIR # ubuntu-versionator_src_unpack } src_prepare() { ubuntu-versionator_src_prepare local i for i in ${packages[@]}; do use ${i} || continue eval "_name=${i}; _uver=\${_uver_${i}}; _urev=\${_urev_${i}}" pushd "${S}/unity-scope-${_name}-${_uver}" >/dev/null || die einfo "Applying the Ubuntu diff file for ${_name} scope" eapply "${S}/unity-scope-${_name}_${_uver}-${_urev}.diff" [[ -f ${FILESDIR}/${i}.patch ]] && eapply "${FILESDIR}/${i}.patch" # Don't install the scope daemon as a top-level Python module # sed -i "s/^setup(name=/setup(py_modules=[], packages=[], name=/" setup.py || die popd >/dev/null || die done } python_compile() { local i # Build all enabled scopes, each of them is a separate setup.py project # for i in ${packages[@]}; do use ${i} || continue eval "_name=${i}; _uver=\${_uver_${i}}" pushd "${S}/unity-scope-${_name}-${_uver}" >/dev/null || die distutils-r1_python_compile popd >/dev/null || die done } src_install() { distutils-r1_src_install local i for i in ${packages[@]}; do use ${i} || continue eval "_name=${i}; _uver=\${_uver_${i}}" pushd "${S}/unity-scope-${_name}-${_uver}" >/dev/null || die # Run the scope with the configured version of Python # sed -i "s:/usr/bin/python3 :${PYTHON} :" \ "${ED}"/usr/share/dbus-1/services/unity-scope-${_name}.service || die grep -Fq "${PYTHON} " "${ED}"/usr/share/dbus-1/services/unity-scope-${_name}.service || die ## Install the Ubuntu changelog and copyright files as in ubuntu-versionator.eclass. ( local x docinto "unity-scope-${_name}-${_uver}" for x in changelog copyright; do [[ -s debian/${x} ]] && newdoc "debian/${x}" "debian.${x}" done ) popd >/dev/null || die done } pkg_postinst() { ubuntu-versionator_pkg_postinst optfeature_header "Install additional packages for the enabled scopes:" use audacious && optfeature "audacious scope" media-sound/audacious use calculator && optfeature "calculator scope" gnome-extra/gnome-calculator mate-extra/mate-calc use chromiumbookmarks && optfeature "chromiumbookmarks scope" www-client/chromium use devhelp && optfeature "devhelp scope" dev-util/devhelp use firefoxbookmarks && optfeature "firefoxbookmarks scope" www-client/firefox www-client/firefox-bin use manpages && optfeature "manpages scope" gnome-extra/yelp use texdoc && optfeature "texdoc scope" "dev-util/devhelp app-text/texlive-core[doc]" use virtualbox && optfeature "virtualbox scope" app-emulation/virtualbox if use manpages; then elog elog "manpages scope needs to run 'mandb' command to create or update the manual page index caches." fi }