app-text/stardict: provide python tools as well

Package-Manager: portage-2.3.2
Signed-off-by: Andrew Savchenko <bircoph@gentoo.org>
This commit is contained in:
Andrew Savchenko
2016-12-03 19:47:35 +03:00
parent 423ab92ca2
commit d615f8f9d7
+20 -4
View File
@@ -9,8 +9,9 @@ EAPI=6
# seperate for now.
GNOME2_LA_PUNT=yes
PYTHON_COMPAT=( python2_7 )
inherit flag-o-matic gnome2
inherit flag-o-matic gnome2 python-single-r1
DESCRIPTION="A international dictionary supporting fuzzy and glob style matching"
HOMEPAGE="http://stardict-4.sourceforge.net/"
@@ -22,8 +23,8 @@ LICENSE="CPL-1.0 GPL-3 LGPL-2"
SLOT="0"
KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc ~x86"
IUSE="advertisement debug dictdotcn espeak examples +gucharmap
+htmlparse man perl +powerwordparse pronounce qqwry spell tools
updateinfo +wikiparse +wordnet +xdxfparse"
+htmlparse man perl +powerwordparse pronounce python qqwry spell
tools updateinfo +wikiparse +wordnet +xdxfparse"
RESTRICT="test"
@@ -41,6 +42,7 @@ COMMON_DEPEND="
dev-libs/libpcre:=
dev-libs/libxml2:=
virtual/mysql
python? ( ${PYTHON_DEPS} )
)
"
RDEPEND="${COMMON_DEPEND}
@@ -54,6 +56,7 @@ DEPEND="${COMMON_DEPEND}
sys-devel/gettext
virtual/pkgconfig
"
REQUIRED_USE="tools? ( python? ( ${PYTHON_REQUIRED_USE} ) )"
# docs are messy, installed manually below
DOCS=""
@@ -68,6 +71,17 @@ src_prepare() {
# libsigc++ started to require c++11 support
append-cxxflags "-std=c++11"
if use python; then
local f
# force python shebangs handlable by python_doscript
for f in tools/src/*.py; do
[[ $(head -n1 "${f}") =~ ^#! ]] || continue
sed -i '1 s|.*|#!/usr/bin/python|' tools/src/*.py || die
done
# script contains UTF-8 symbols, but has no ecoding set
sed -i '1 a # -*- coding: utf-8 -*-' tools/src/uyghur2dict.py || die
fi
eapply_user
gnome2_src_prepare
}
@@ -147,6 +161,8 @@ src_install() {
${PN}-bin2text ${PN}-repair"
use perl && apps+=" dicts-dump.pl ncce2stardict.pl parse-oxford.perl"
use python && apps+=" hanzim2dict.py jm2stardict.py lingea-trd-decoder.py
makevietdict.py uyghur2dict.py"
for app in ${apps}; do
if [[ "${app}" =~ ^${PN} ]]; then
@@ -155,12 +171,12 @@ src_install() {
newbin "tools/src/${app}" "${PN}_${app}"
fi
done
use python && python_doscript "${ED}"usr/bin/*.py
docinto tools
dodoc tools/{AUTHORS,ChangeLog,README}
if use examples; then
insinto tools
insinto /usr/share/doc/${PF}/tools
doins tools/src/{dictbuilder.{example,readme},example.ifo,example_treedict.tar.bz2}
fi