void-packages/srcpkgs/python-docutils/patches/0021-Remove-auxiliary-Python-2-3-compatibility-definition.patch
Doan Tran Cong Danh 6b24f153d7 python3-docutils: unbroken: import from upstream
All of those patches are picked from upstream.

    xbps-src check python3-docutils

works fine now!
2019-12-01 12:38:58 +01:00

91 lines
2.6 KiB
Diff

From 3a610d205259bcf7f22fd8c33c78ffb70829989d Mon Sep 17 00:00:00 2001
From: Stephen Finucane <stephen@that.guru>
Date: Wed, 20 Nov 2019 00:14:11 +0700
Subject: [PATCH 21/26] Remove auxiliary Python 2/3 compatibility definition
module.
No longer required since setting minimal supported version to 2.7.
The remaining issues are now handled directly in the affected modules.
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8369 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
---
docutils/_compat.py | 24 ------------------------
test/test_publisher.py | 8 +++++++-
test/test_writers/test_odt.py | 3 +--
3 files changed, 8 insertions(+), 27 deletions(-)
delete mode 100644 docutils/_compat.py
diff --git a/docutils/_compat.py b/docutils/_compat.py
deleted file mode 100644
index 1ff959c..0000000
--- a/docutils/_compat.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# $Id: _compat.py 8164 2017-08-14 11:28:48Z milde $
-# Author: Georg Brandl <georg@python.org>
-# Copyright: This module has been placed in the public domain.
-
-"""
-Python 2/3 compatibility definitions.
-
-This module currently provides the following helper symbols:
-
-* u_prefix (unicode repr prefix: 'u' in 2.x, '' in 3.x)
- (Required in docutils/test/test_publisher.py)
-* BytesIO (a StringIO class that works with bytestrings)
-"""
-
-import sys
-
-if sys.version_info < (3, 0):
- u_prefix = 'u'
- from StringIO import StringIO as BytesIO
-else:
- u_prefix = b''
- # using this hack since 2to3 "fixes" the relative import
- # when using ``from io import BytesIO``
- BytesIO = __import__('io').BytesIO
diff --git a/test/test_publisher.py b/test/test_publisher.py
index 04d9c71..2c3845c 100755
--- a/test/test_publisher.py
+++ b/test/test_publisher.py
@@ -9,10 +9,16 @@ Test the `Publisher` facade and the ``publish_*`` convenience functions.
"""
import pickle
+import sys
+
import DocutilsTestSupport # must be imported before docutils
import docutils
from docutils import core, nodes, io
-from docutils._compat import u_prefix
+
+if sys.version_info < (3, 0):
+ u_prefix = 'u'
+else:
+ u_prefix = b''
test_document = """\
diff --git a/test/test_writers/test_odt.py b/test/test_writers/test_odt.py
index a47b7fb..6ec3ef2 100755
--- a/test/test_writers/test_odt.py
+++ b/test/test_writers/test_odt.py
@@ -36,12 +36,11 @@ import os
import zipfile
from xml.dom import minidom
import tempfile
+from io import BytesIO
from . import DocutilsTestSupport
-
import docutils
import docutils.core
-from docutils._compat import BytesIO
#
# Globals
--
2.24.0.375.geb5ae68d41