[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#991161: unblock: python-nosehtmloutput/0.0.5-3



Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock

Please unblock package python-nosehtmloutput

This fixes #990816 (ie: unuseable package, it seems).
I applied upstream Python 3 support patch which fixes
the issue.

This is kind of a low risk leaf package, only used to
build docs, so IMO nothing to worry much about.

[ Checklist ]
  [x] all changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in testing

unblock python-nosehtmloutput/0.0.5-3
diff -Nru python-nosehtmloutput-0.0.5/debian/changelog python-nosehtmloutput-0.0.5/debian/changelog
--- python-nosehtmloutput-0.0.5/debian/changelog	2019-09-02 09:06:42.000000000 +0200
+++ python-nosehtmloutput-0.0.5/debian/changelog	2021-07-16 09:23:39.000000000 +0200
@@ -1,3 +1,9 @@
+python-nosehtmloutput (0.0.5-3) unstable; urgency=medium
+
+  * Added upstream "Python 3 support" patch (Closes: #990816).
+
+ -- Thomas Goirand <zigo@debian.org>  Fri, 16 Jul 2021 09:23:39 +0200
+
 python-nosehtmloutput (0.0.5-2) unstable; urgency=medium
 
   * Team upload.
diff -Nru python-nosehtmloutput-0.0.5/debian/patches/Python-3-support.patch python-nosehtmloutput-0.0.5/debian/patches/Python-3-support.patch
--- python-nosehtmloutput-0.0.5/debian/patches/Python-3-support.patch	1970-01-01 01:00:00.000000000 +0100
+++ python-nosehtmloutput-0.0.5/debian/patches/Python-3-support.patch	2021-07-16 09:23:39.000000000 +0200
@@ -0,0 +1,84 @@
+Description: Python 3 support
+ * Implicit relative import 'import version' to import htmloutput.version.
+   Use explicit relative import instead 'from . import version'.
+   Somehow 'from htmloutput import version' does not work for python2
+   when I tested this with horizon nosetest.
+ * Python3 dict does not has_key(). Use 'not in' instead.
+ * Open a file for writing with 'wb' (binary mode).
+   In Python 3, encode() converts unicode including regular string into
+   bytes. In Python 2, encode() converts unicode string into string and
+   string and bytes are handled equivalently. Thus, opening a file with
+   binary mode works both for python2 and python3.
+ * Decoding from string to unicode is only needed for Python 2,
+   so six.PY2 check is added to isinstance(x, str) if-clause.
+Author: Akihiro Motoki <amotoki@gmail.com>
+Date: Thu, 22 Jun 2017 19:18:31 +0900
+Change-Id: Ied161e133ced1d672aba9d1a44b52034dfb676da
+Origin: upstream, https://github.com/openstack/nose-html-output/commit/71d12999b06908bbb019f69c89361bd44bec316c.patch
+
+Index: python-nosehtmloutput/htmloutput/htmloutput.py
+===================================================================
+--- python-nosehtmloutput.orig/htmloutput/htmloutput.py
++++ python-nosehtmloutput/htmloutput/htmloutput.py
+@@ -44,7 +44,9 @@ from nose.plugins import Plugin
+ import nose.plugins.skip
+ from xml.sax import saxutils
+ 
+-import version
++import six
++
++from . import version
+ __version__ = version.__version__
+ 
+ class TemplateData(object):
+@@ -513,7 +515,7 @@ class HtmlOutput(Plugin):
+             ending = ending,
+         )
+         if self.html_file:
+-            html_file = open(self.html_file, 'w')
++            html_file = open(self.html_file, 'wb')
+             html_file.write(output.encode('utf8'))
+         else:
+             stream.write(output.encode('utf8'))
+@@ -621,7 +623,7 @@ class HtmlOutput(Plugin):
+             cls = test.test.__class__
+         else:
+             cls = test.__class__
+-        if not rmap.has_key(cls):
++        if cls not in rmap:
+             rmap[cls] = []
+             classes.append(cls)
+         rmap[cls].append(data_tuple)
+@@ -639,13 +641,17 @@ class HtmlOutput(Plugin):
+         # Comments below from the original source project.
+         # TODO: clean this up within the context of a nose plugin.
+         # o and e should be byte string because they are collected from stdout and stderr?
+-        if isinstance(o,str):
++        # NOTE: In Python3 unicode is natively supported as string,
++        # so there is no need to decode() here.
++        if six.PY2 and isinstance(o, str):
+             # TODO: some problem with 'string_escape': it escape \n and mess up formating
+             # uo = unicode(o.encode('string_escape'))
+             uo = o.decode('latin-1')
+         else:
+             uo = o
+-        if isinstance(e,str):
++        # NOTE: In Python3 unicode is natively supported as string,
++        # so there is no need to decode() here.
++        if six.PY2 and isinstance(e, str):
+             # TODO: some problem with 'string_escape': it escape \n and mess up formating
+             # ue = unicode(e.encode('string_escape'))
+             ue = e.decode('latin-1')
+Index: python-nosehtmloutput/setup.py
+===================================================================
+--- python-nosehtmloutput.orig/setup.py
++++ python-nosehtmloutput/setup.py
+@@ -9,7 +9,7 @@ setuptools.setup(
+     license="Apache License, Version 2.0",
+     url="https://github.com/openstack-infra/nose-html-output";,
+     packages=["htmloutput"],
+-    install_requires=['nose'],
++    install_requires=['nose', 'six'],
+     classifiers=[
+         "Environment :: Console",
+         "Topic :: Software Development :: Testing",
diff -Nru python-nosehtmloutput-0.0.5/debian/patches/series python-nosehtmloutput-0.0.5/debian/patches/series
--- python-nosehtmloutput-0.0.5/debian/patches/series	1970-01-01 01:00:00.000000000 +0100
+++ python-nosehtmloutput-0.0.5/debian/patches/series	2021-07-16 09:23:39.000000000 +0200
@@ -0,0 +1 @@
+Python-3-support.patch

Reply to: