[Python-modules-commits] [stepic] 04/10: Add debian/patches/0004-Port-to-python3.patch to port stepic to python3
Scott Kitterman
kitterman at moszumanska.debian.org
Sat Jan 6 08:21:59 UTC 2018
This is an automated email from the git hooks/post-receive script.
kitterman pushed a commit to branch debian/master
in repository stepic.
commit f9bc569a4d1d84546983c7c490a23587fff5b76a
Author: Scott Kitterman <scott at kitterman.com>
Date: Sat Jan 6 01:59:32 2018 -0500
Add debian/patches/0004-Port-to-python3.patch to port stepic to python3
---
debian/changelog | 3 +-
debian/patches/0004-Port-to-python3.patch | 89 +++++++++++++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 92 insertions(+), 1 deletion(-)
diff --git a/debian/changelog b/debian/changelog
index c98bcbd..5127e83 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,7 @@ stepic (0.3-6) UNRELEASED; urgency=medium
* Fixed VCS URL (https)
[ Scott Kitterman ]
+ * Add debian/patches/0004-Port-to-python3.patch to port stepic to python3
* Refresh patches after svn/git-dpm to gbp pq conversion
* Update obsolete python-imaging depends with python-pil (Closes: #866482)
* Bump compat/debhelper minimum version to 9
@@ -11,7 +12,7 @@ stepic (0.3-6) UNRELEASED; urgency=medium
all supported Debian releases
* Bump standards-version to 4.1.3 without further change
- -- Scott Kitterman <scott at kitterman.com> Sat, 06 Jan 2018 01:15:02 -0500
+ -- Scott Kitterman <scott at kitterman.com> Sat, 06 Jan 2018 01:58:07 -0500
stepic (0.3-5) unstable; urgency=medium
diff --git a/debian/patches/0004-Port-to-python3.patch b/debian/patches/0004-Port-to-python3.patch
new file mode 100644
index 0000000..8711675
--- /dev/null
+++ b/debian/patches/0004-Port-to-python3.patch
@@ -0,0 +1,89 @@
+From: Scott Kitterman <scott at kitterman.com>
+Date: Sat, 6 Jan 2018 01:57:09 -0500
+Subject: Port to python3
+
+---
+ stepic | 14 ++++++++------
+ stepic.py | 14 +++++++-------
+ 2 files changed, 15 insertions(+), 13 deletions(-)
+
+diff --git a/stepic b/stepic
+index 38deb48..2337344 100755
+--- a/stepic
++++ b/stepic
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#! /usr/bin/python3
+
+ # stepic - Python image steganography
+ # Copyright (C) 2007 Lenny Domnitser
+@@ -21,7 +21,7 @@
+ import optparse
+ import sys
+ import traceback
+-import Image
++from PIL import Image
+ import stepic
+
+
+@@ -73,13 +73,15 @@ def main():
+ decode_files(options.image_in, options.out)
+ elif options.encode:
+ encode_files(options.image_in, options.data_in, options.out, options.format)
+- except (TypeError, ValueError), e:
+- print >> sys.stderr, 'error:', e
++ except (TypeError, ValueError) as e:
++ message = 'error: ' + str(e) + '\n'
++ sys.stderr.write(message)
+ sys.exit(1)
+ except KeyboardInterrupt:
+ pass
+- except Exception, e:
+- print >> sys.stderr, '%s: %s' % (e.__class__.__name__, e)
++ except Exception as e:
++ message = e.__class__.__name__ + ': ' + str(e) + '\n'
++ sys.stderr.write(message)
+ if options.debug:
+ traceback.print_tb(sys.exc_traceback)
+ sys.exit(3)
+diff --git a/stepic.py b/stepic.py
+index 0f74be9..0674afc 100644
+--- a/stepic.py
++++ b/stepic.py
+@@ -29,7 +29,7 @@ __version__ = '0.3'
+
+ import warnings
+ try:
+- import Image
++ from PIL import Image
+ except:
+ warnings.warn('Could not find PIL. Only encode_imdata and decode_imdata will work.',
+ ImportWarning, stacklevel=2)
+@@ -60,11 +60,11 @@ def encode_imdata(imdata, data):
+
+ imdata = iter(imdata)
+
+- for i in xrange(datalen):
++ for i in range(datalen):
+ pixels = [value & ~1 for value in
+- imdata.next()[:3] + imdata.next()[:3] + imdata.next()[:3]]
+- byte = ord(data[i])
+- for j in xrange(7, -1, -1):
++ imdata.__next__()[:3] + imdata.__next__()[:3] + imdata.__next__()[:3]]
++ byte = data[i]
++ for j in range(7, -1, -1):
+ pixels[j] |= byte & 1
+ byte >>= 1
+ if i == datalen - 1:
+@@ -106,9 +106,9 @@ def decode_imdata(imdata):
+
+ imdata = iter(imdata)
+ while True:
+- pixels = list(imdata.next()[:3] + imdata.next()[:3] + imdata.next()[:3])
++ pixels = list(imdata.__next__()[:3] + imdata.__next__()[:3] + imdata.__next__()[:3])
+ byte = 0
+- for c in xrange(7):
++ for c in range(7):
+ byte |= pixels[c] & 1
+ byte <<= 1
+ byte |= pixels[7] & 1
diff --git a/debian/patches/series b/debian/patches/series
index 02d9838..476c6ee 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
0001-fix-shebang.patch
0002-fix-version.patch
0003-no-jpeg.patch
+0004-Port-to-python3.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/stepic.git
More information about the Python-modules-commits
mailing list