public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: kde-apps/kig/files/, kde-apps/kig/
@ 2019-12-15 15:48 Andreas Sturmlechner
  0 siblings, 0 replies; only message in thread
From: Andreas Sturmlechner @ 2019-12-15 15:48 UTC (permalink / raw
  To: gentoo-commits

commit:     d165bd9a9cbd8e89feb8ec38d451fcb5d1b81c02
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 15 15:28:37 2019 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sun Dec 15 15:36:25 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d165bd9a

kde-apps/kig: Backport python3 support

Package-Manager: Portage-2.3.81, Repoman-2.3.20
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 kde-apps/kig/files/kig-19.08.3-pykig-python3.patch | 161 +++++++++++++++++++++
 .../kig/files/kig-19.08.3-scripter-python3.patch   |  27 ++++
 kde-apps/kig/kig-19.08.3-r1.ebuild                 |  72 +++++++++
 kde-apps/kig/kig-19.12.0-r1.ebuild                 |  71 +++++++++
 4 files changed, 331 insertions(+)

diff --git a/kde-apps/kig/files/kig-19.08.3-pykig-python3.patch b/kde-apps/kig/files/kig-19.08.3-pykig-python3.patch
new file mode 100644
index 00000000000..902c138495e
--- /dev/null
+++ b/kde-apps/kig/files/kig-19.08.3-pykig-python3.patch
@@ -0,0 +1,161 @@
+From d72f33a14c22480b28c0f35d53293826f6ec787b Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Sat, 14 Dec 2019 19:49:09 +0100
+Subject: Port pykig to python 3
+
+Differential Revision: https://phabricator.kde.org/D25982
+---
+ pykig/pykig.py | 42 +++++++++++++++++++++---------------------
+ 1 file changed, 21 insertions(+), 21 deletions(-)
+
+diff --git a/pykig/pykig.py b/pykig/pykig.py
+index 02f637d..3ee6e97 100644
+--- a/pykig/pykig.py
++++ b/pykig/pykig.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ # -*- coding: utf-8 -*-
+ #-------------------------------python------------------------pykig.py--#
+ #                                                                       #
+@@ -170,9 +170,9 @@ class KigDocument(object):
+     self.of=of
+     try:
+       self.outfile = open(outfilename, 'w')
+-    except IOError, value:
++    except IOError as value:
+ #      print >> sys.stderr, outfilename, 'unwritable'
+-      print >> sys.stderr, value
++      print(value,  file=sys.stderr)
+       sys.exit(2)
+ #    KigOut._kigdocument=self
+     KigDOP._kd=self
+@@ -212,14 +212,14 @@ class KigDocument(object):
+       self.outfile.write(" </View>\n</KigDocument>\n")
+       if self.outfile != sys.stdout:
+         self.outfile.close()
+-    except IOError, value:
+-      print >> sys.stderr, value
++    except IOError as value:
++      print(value, file=sys.stderr)
+       sys.exit(2)
+     try:
+       if self.callkig:
+         err = os.system('kig ' + self.outfilename)
+-    except Exception, value:
+-      print >> sys.stderr, value      
++    except Exception as value:
++      print(value, file=sys.stderr)
+     if not self.of:
+       os.system('rm ' + self.outfilename)
+ 
+@@ -501,7 +501,7 @@ def databuild(nomeclasse, nomekig, v="val"):
+ 
+ for d in data:
+   p1, p2, p3 = d
+-  exec databuild(p1, p2, p3)
++  exec (databuild(p1, p2, p3))
+ 
+ #####
+ # Objects
+@@ -645,7 +645,7 @@ def objectbuild(nameclass, namekig, params, objparams):
+ 
+ for o in objects:
+   p1, p2, p3, p4 = o
+-  exec objectbuild(p1, p2, p3, p4)
++  exec (objectbuild(p1, p2, p3, p4))
+ 
+ #####
+ # Properties
+@@ -688,7 +688,7 @@ def propertybuild(nameclass, namekig, params, objparams):
+ 
+ for p in property:
+   p1, p2, p3, p4 = p
+-  exec propertybuild(p1, p2, p3, p4)
++  exec (propertybuild(p1, p2, p3, p4))
+ 
+ #####
+ # Start of properties definitions as Object's methods
+@@ -734,7 +734,7 @@ def methodsbuild(namekig):
+ 
+ for p in methods:
+   p1, p2, cl = p
+-  exec methodsbuild(p1)
++  exec (methodsbuild(p1))
+   for c in cl:
+     setattr(c, p2, method)
+ 
+@@ -743,7 +743,7 @@ for p in methods:
+ #####
+ 
+ def usage(codexit):
+-  print >> sys.stderr, """
++  print ("""
+ usage: pykig.py [options...] file ...
+ 
+ Options:
+@@ -757,7 +757,7 @@ examples:
+     $ pykig.py my_file.kpy
+     $ pykig.py -o output_file.kig my_file.kpy
+     $ ...
+-"""
++""", file=sys.stderr)
+   sys.exit(codexit)
+ 
+ #####
+@@ -776,7 +776,7 @@ def prog():
+     _opts, _args = getopt.getopt(sys.argv[1:], "hvno:",\
+                                  ["help", "version", "nokig", "output="])
+   except getopt.GetoptError:
+-    print "GetoptError"
++    print ("GetoptError")
+     usage(2)
+   _callKig=True
+   _of=False
+@@ -784,7 +784,7 @@ def prog():
+     if _opt in ("-h", "--help"):
+       usage(0)
+     if _opt in ("-v", "--version"):
+-      print "Version:", version
++      print ("Version:", version)
+       sys.exit(0)
+     if _opt in ("-n", "--nokig"):
+       _callKig=False
+@@ -793,19 +793,19 @@ def prog():
+       _of=True
+       _callKig=False   # if there's an output file, don't call Kig
+   if len(_args)==0:
+-    _infilename=raw_input("Input file name: ")
++    _infilename=input("Input file name: ")
+     if not _infilename:
+-      print "No input file name."
++      print ("No input file name.")
+       usage(2)
+   elif len(_args)==1:
+     _infilename=_args[0]
+   else:
+-    print "No input file name."
++    print ("No input file name.")
+     usage(2)
+   try:
+     _infile = open(_infilename, 'r')
+   except:
+-    print >> sys.stderr, _infilename, "input file can't be read."
++    print (_infilename, "input file can't be read.", file=sys.stderr)
+     sys.exit(2)
+   if _of:
+     if _outfilename=="-":
+@@ -817,9 +817,9 @@ def prog():
+   kigdocument=KigDocument(_outfilename, _callKig, _of)
+   kd=kigdocument
+   try:
+-    execfile(_infilename, globals())
++    exec(open(_infilename).read(), globals())
+   except:
+-    print >> sys.stderr, 'Syntax error in', _infilename
++    print ('Syntax error in', _infilename, file=sys.stderr)
+     _info = sys.exc_info()    # print out the traceback
+     traceback.print_exc()
+     sys.exit(3)
+-- 
+cgit v1.1

diff --git a/kde-apps/kig/files/kig-19.08.3-scripter-python3.patch b/kde-apps/kig/files/kig-19.08.3-scripter-python3.patch
new file mode 100644
index 00000000000..19c5f9535a1
--- /dev/null
+++ b/kde-apps/kig/files/kig-19.08.3-scripter-python3.patch
@@ -0,0 +1,27 @@
+From e0dae6b9938963c8f3c30ac7b8182452645e2dbf Mon Sep 17 00:00:00 2001
+From: Yuri Chornoivan <yurchor@ukr.net>
+Date: Tue, 22 Oct 2019 20:42:51 +0300
+Subject: Try to fix Python 3 build
+
+---
+ scripting/python_scripter.cc | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/scripting/python_scripter.cc b/scripting/python_scripter.cc
+index e60a90c..62a7409 100644
+--- a/scripting/python_scripter.cc
++++ b/scripting/python_scripter.cc
+@@ -390,7 +390,11 @@ PythonScripter::PythonScripter()
+   // the newstring stuff is to prevent warnings about conversion from
+   // const char* to char*..
+   char* s = newstring( "kig" );
++#if PY_VERSION_HEX >= 0x03000000
++  PyImport_AppendInittab( s, PyInit_kig );
++#else
+   PyImport_AppendInittab( s, initkig );
++#endif
+   //  we can't delete this yet, since python keeps a pointer to it..
+   // This means we have a small but harmless memory leak here, but it
+   // doesn't hurt at all, since it could only be freed at the end of
+-- 
+cgit v1.1

diff --git a/kde-apps/kig/kig-19.08.3-r1.ebuild b/kde-apps/kig/kig-19.08.3-r1.ebuild
new file mode 100644
index 00000000000..3d0c68469d0
--- /dev/null
+++ b/kde-apps/kig/kig-19.08.3-r1.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+ECM_HANDBOOK="forceoptional"
+ECM_TEST="true"
+PYTHON_COMPAT=( python3_{6,7,8} )
+KFMIN=5.60.0
+QTMIN=5.12.3
+inherit python-single-r1 ecm kde.org
+
+DESCRIPTION="KDE Interactive Geometry tool"
+HOMEPAGE="https://kde.org/applications/education/org.kde.kig
+https://edu.kde.org/kig/"
+
+LICENSE="GPL-2" # TODO: CHECK
+SLOT="5"
+KEYWORDS="~amd64 ~arm64 ~x86"
+IUSE="geogebra scripting"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+RDEPEND="${PYTHON_DEPS}
+	>=dev-qt/qtgui-${QTMIN}:5
+	>=dev-qt/qtprintsupport-${QTMIN}:5
+	>=dev-qt/qtsvg-${QTMIN}:5
+	>=dev-qt/qtwidgets-${QTMIN}:5
+	>=dev-qt/qtxml-${QTMIN}:5
+	>=kde-frameworks/karchive-${KFMIN}:5
+	>=kde-frameworks/kcompletion-${KFMIN}:5
+	>=kde-frameworks/kconfig-${KFMIN}:5
+	>=kde-frameworks/kconfigwidgets-${KFMIN}:5
+	>=kde-frameworks/kcoreaddons-${KFMIN}:5
+	>=kde-frameworks/kcrash-${KFMIN}:5
+	>=kde-frameworks/ki18n-${KFMIN}:5
+	>=kde-frameworks/kiconthemes-${KFMIN}:5
+	>=kde-frameworks/kparts-${KFMIN}:5
+	>=kde-frameworks/kservice-${KFMIN}:5
+	>=kde-frameworks/kwidgetsaddons-${KFMIN}:5
+	>=kde-frameworks/kxmlgui-${KFMIN}:5
+	geogebra? ( >=dev-qt/qtxmlpatterns-${QTMIN}:5 )
+	scripting? ( >=dev-libs/boost-1.48:=[python,${PYTHON_USEDEP}] )
+"
+DEPEND="${RDEPEND}
+	>=kde-frameworks/ktexteditor-${KFMIN}:5
+"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-4.12.0-boostpython.patch
+	"${FILESDIR}"/${P}-scripter-python3.patch
+	"${FILESDIR}"/${P}-pykig-python3.patch
+)
+
+pkg_setup() {
+	python-single-r1_pkg_setup
+	ecm_pkg_setup
+}
+
+src_prepare() {
+	ecm_src_prepare
+	python_fix_shebang .
+}
+
+src_configure() {
+	local mycmakeargs=(
+		$(cmake_use_find_package geogebra Qt5XmlPatterns)
+		$(cmake_use_find_package scripting BoostPython)
+	)
+
+	ecm_src_configure
+}

diff --git a/kde-apps/kig/kig-19.12.0-r1.ebuild b/kde-apps/kig/kig-19.12.0-r1.ebuild
new file mode 100644
index 00000000000..44b0902c3a3
--- /dev/null
+++ b/kde-apps/kig/kig-19.12.0-r1.ebuild
@@ -0,0 +1,71 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+ECM_HANDBOOK="forceoptional"
+ECM_TEST="true"
+PYTHON_COMPAT=( python3_{6,7,8} )
+KFMIN=5.63.0
+QTMIN=5.12.3
+inherit python-single-r1 ecm kde.org
+
+DESCRIPTION="KDE Interactive Geometry tool"
+HOMEPAGE="https://kde.org/applications/education/org.kde.kig
+https://edu.kde.org/kig/"
+
+LICENSE="GPL-2" # TODO: CHECK
+SLOT="5"
+KEYWORDS="~amd64 ~arm64 ~x86"
+IUSE="geogebra scripting"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+RDEPEND="${PYTHON_DEPS}
+	>=dev-qt/qtgui-${QTMIN}:5
+	>=dev-qt/qtprintsupport-${QTMIN}:5
+	>=dev-qt/qtsvg-${QTMIN}:5
+	>=dev-qt/qtwidgets-${QTMIN}:5
+	>=dev-qt/qtxml-${QTMIN}:5
+	>=kde-frameworks/karchive-${KFMIN}:5
+	>=kde-frameworks/kcompletion-${KFMIN}:5
+	>=kde-frameworks/kconfig-${KFMIN}:5
+	>=kde-frameworks/kconfigwidgets-${KFMIN}:5
+	>=kde-frameworks/kcoreaddons-${KFMIN}:5
+	>=kde-frameworks/kcrash-${KFMIN}:5
+	>=kde-frameworks/ki18n-${KFMIN}:5
+	>=kde-frameworks/kiconthemes-${KFMIN}:5
+	>=kde-frameworks/kparts-${KFMIN}:5
+	>=kde-frameworks/kservice-${KFMIN}:5
+	>=kde-frameworks/kwidgetsaddons-${KFMIN}:5
+	>=kde-frameworks/kxmlgui-${KFMIN}:5
+	geogebra? ( >=dev-qt/qtxmlpatterns-${QTMIN}:5 )
+	scripting? ( >=dev-libs/boost-1.48:=[python,${PYTHON_USEDEP}] )
+"
+DEPEND="${RDEPEND}
+	>=kde-frameworks/ktexteditor-${KFMIN}:5
+"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-4.12.0-boostpython.patch
+	"${FILESDIR}"/${PN}-19.08.3-pykig-python3.patch
+)
+
+pkg_setup() {
+	python-single-r1_pkg_setup
+	ecm_pkg_setup
+}
+
+src_prepare() {
+	ecm_src_prepare
+	python_fix_shebang .
+}
+
+src_configure() {
+	local mycmakeargs=(
+		$(cmake_use_find_package geogebra Qt5XmlPatterns)
+		$(cmake_use_find_package scripting BoostPython)
+	)
+
+	ecm_src_configure
+}


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-12-15 15:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-15 15:48 [gentoo-commits] repo/gentoo:master commit in: kde-apps/kig/files/, kde-apps/kig/ Andreas Sturmlechner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox