From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-914876-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id D40A31395E2
	for <garchives@archives.gentoo.org>; Sat,  3 Dec 2016 16:47:43 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id A5184E0BFE;
	Sat,  3 Dec 2016 16:47:42 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 6D772E0BFE
	for <gentoo-commits@lists.gentoo.org>; Sat,  3 Dec 2016 16:47:42 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 1170934125C
	for <gentoo-commits@lists.gentoo.org>; Sat,  3 Dec 2016 16:47:41 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 7601B24B0
	for <gentoo-commits@lists.gentoo.org>; Sat,  3 Dec 2016 16:47:39 +0000 (UTC)
From: "Andrew Savchenko" <bircoph@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Andrew Savchenko" <bircoph@gentoo.org>
Message-ID: <1480783655.d615f8f9d771a4e52ea5d4a27ec2e0bdd37e0dcb.bircoph@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: app-text/stardict/
X-VCS-Repository: repo/gentoo
X-VCS-Files: app-text/stardict/stardict-3.0.6-r3.ebuild
X-VCS-Directories: app-text/stardict/
X-VCS-Committer: bircoph
X-VCS-Committer-Name: Andrew Savchenko
X-VCS-Revision: d615f8f9d771a4e52ea5d4a27ec2e0bdd37e0dcb
X-VCS-Branch: master
Date: Sat,  3 Dec 2016 16:47:39 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: d67096e0-246d-491d-bd96-e44e2972c250
X-Archives-Hash: 52d96c6c31969ce440ed7f64cd8afb63

commit:     d615f8f9d771a4e52ea5d4a27ec2e0bdd37e0dcb
Author:     Andrew Savchenko <bircoph <AT> gentoo <DOT> org>
AuthorDate: Sat Dec  3 16:47:06 2016 +0000
Commit:     Andrew Savchenko <bircoph <AT> gentoo <DOT> org>
CommitDate: Sat Dec  3 16:47:35 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d615f8f9

app-text/stardict: provide python tools as well

Package-Manager: portage-2.3.2
Signed-off-by: Andrew Savchenko <bircoph <AT> gentoo.org>

 app-text/stardict/stardict-3.0.6-r3.ebuild | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/app-text/stardict/stardict-3.0.6-r3.ebuild b/app-text/stardict/stardict-3.0.6-r3.ebuild
index e793103..aaf45c1 100644
--- a/app-text/stardict/stardict-3.0.6-r3.ebuild
+++ b/app-text/stardict/stardict-3.0.6-r3.ebuild
@@ -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