commit:     f17145ba725c8f46cf096fc5bbd425b4a09136ab
Author:     Brian Evans <grknight <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 25 13:25:31 2018 +0000
Commit:     Brian Evans <grknight <AT> gentoo <DOT> org>
CommitDate: Mon Jun 25 13:28:39 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f17145ba

dev-util/imediff2: Add python 3 support

Closes: https://bugs.gentoo.org/650050
Package-Manager: Portage-2.3.40, Repoman-2.3.9

 dev-util/imediff2/files/1.1.2-python-3.patch | 113 +++++++++++++++++++++++++++
 dev-util/imediff2/imediff2-1.1.2-r4.ebuild   |  39 +++++++++
 2 files changed, 152 insertions(+)

diff --git a/dev-util/imediff2/files/1.1.2-python-3.patch 
b/dev-util/imediff2/files/1.1.2-python-3.patch
new file mode 100644
index 00000000000..a7b4fadf4d6
--- /dev/null
+++ b/dev-util/imediff2/files/1.1.2-python-3.patch
@@ -0,0 +1,113 @@
+--- a/imediff2 2017-11-14 09:28:57.007929569 -0500
++++ b/imediff2 2017-11-14 10:11:12.618496692 -0500
+@@ -18,10 +18,12 @@
+ # License along with the program; if not, write to the Free Software
+ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ 
+-VERSION = '1.1.1'
++VERSION = '1.1.2'
+ PACKAGE = 'imediff2'
+ 
+-import curses.wrapper
++import sys
++if sys.version_info<(3,0,0):
++  import curses.wrapper
+ import curses
+ import tempfile
+ import gettext
+@@ -31,7 +33,6 @@
+ import types
+ import time
+ import pty
+-import sys
+ import os
+ import errno
+ 
+@@ -121,19 +122,19 @@
+ def read_lines( filename ):
+   global assume_empty
+   try:
+-    fp = file( filename )
++    fp = open( filename )
+     l = fp.readlines()
+     fp.close()
+     return l
+-  except IOError, (error, message):
+-    if error == errno.ENOENT and assume_empty:
++  except IOError as e:
++    if e.error == errno.ENOENT and assume_empty:
+       return ""
+     else:
+-      sys.stderr.write(_("Could not read '%s': %s\n") % (filename, message))
++      sys.stderr.write(_("Could not read '%s': %s\n") % (filename, e.message))
+       sys.exit(3)
+ 
+ def strip_end_lines( txt ):
+-  return string.replace(string.replace(txt,"%c"%10,""),"%c"%13,"")
++  return txt.replace("%c"%10,"").replace("%c"%13,"")
+ 
+ def main(stdscr, lines_a, lines_b, start_mode):
+   global sel, active_chunks, x,y, lines, textpad, contw,conth
+@@ -237,7 +238,7 @@
+         active_chunks.append( [j, j+len(line_list), i] )
+ 
+       for l in line_list:
+-        lines.append( [string.expandtabs(strip_end_lines(l)),
++        lines.append( [strip_end_lines(l).expandtabs(),
+           decor, color_pair] )
+         j+=1
+ 
+@@ -512,21 +513,21 @@
+ try:
+   opts, args = getopt.getopt(sys.argv[1:], "hmuo:abcNV",
+     ["help","mono","unresolved","output=", "version", "new-file"])
+-except getopt.GetoptError, e:
+-  print _("Error: ") + str(e)
+-  print usagetext()
++except getopt.GetoptError as e:
++  print(_("Error: ") + str(e))
++  print(usagetext())
+   sys.exit(2)
+ 
+ for o, a in opts:
+   if o in ("-h", "--help"):
+-    print usagetext()
++    print(usagetext())
+     sys.exit()
+   elif o in ("-V", "--version"):
+-    print "%s %s" % (PACKAGE, VERSION)
++    print("%s %s" % (PACKAGE, VERSION))
+     sys.exit()
+ 
+ if len(args)<2:
+-  print usagetext()
++  print(usagetext())
+   sys.exit(2)
+ 
+ for o, a in opts:
+@@ -607,8 +608,8 @@
+         else:
+           chunks = 'old'
+       os.unlink(of_name)
+-    except IOError, (error, message):
+-      sys.stderr.write(_("Could not write to '%s': %s\n") % (of_name, 
message));
++    except IOError as e:
++      sys.stderr.write(_("Could not write to '%s': %s\n") % (of_name, 
e.message));
+ 
+   if not launch_editor:
+     break
+@@ -619,11 +620,11 @@
+ else:
+   try:
+     if ofile is not None:
+-      of = file(ofile, 'wb')
++      of = open(ofile, 'w')
+       of.write( output )
+       of.close()
+     sys.exit(0)
+-  except IOError, (error, message):
+-    sys.stderr.write(_("Could not write to '%s': %s\n") % (ofile, message));
++  except IOError as e:
++    sys.stderr.write(_("Could not write to '%s': %s\n") % (ofile, e.message));
+ 
+ sys.exit(3)

diff --git a/dev-util/imediff2/imediff2-1.1.2-r4.ebuild 
b/dev-util/imediff2/imediff2-1.1.2-r4.ebuild
new file mode 100644
index 00000000000..22d3fb364d1
--- /dev/null
+++ b/dev-util/imediff2/imediff2-1.1.2-r4.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python2_7 python3_5 python3_6 )
+PYTHON_REQ_USE="ncurses"
+
+inherit python-single-r1 versionator
+
+MY_P=${PN}_$(replace_version_separator 3 -)
+
+DESCRIPTION="An interactive, user friendly 2-way merge tool in text mode"
+HOMEPAGE="https://elonen.iki.fi/code/imediff/";
+SRC_URI="mirror://debian/pool/main/i/${PN}/${MY_P}.orig.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND="${PYTHON_DEPS}"
+RDEPEND="${DEPEND}"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+S=${WORKDIR}/${PN}
+
+PATCHES=( "${FILESDIR}/${PV}-python-3.patch" )
+
+src_compile() {
+       # Otherwise the docs get regenerated :)
+       :
+}
+
+src_install() {
+       python_doscript imediff2
+       dodoc AUTHORS README
+       doman imediff2.1
+}

Reply via email to