Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Aug 2019 04:31:14 +0000 (UTC)
From:      Sunpoet Po-Chuan Hsieh <sunpoet@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r508053 - in head/textproc/py-docutils: . files
Message-ID:  <201908040431.x744VEpl058449@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sunpoet
Date: Sun Aug  4 04:31:14 2019
New Revision: 508053
URL: https://svnweb.freebsd.org/changeset/ports/508053

Log:
  Fix build of dependent ports with Python 2.7
  
  - Bump PORTREVISION for package change
  
  Obtained from:  https://sourceforge.net/p/docutils/code/8294/

Added:
  head/textproc/py-docutils/files/
  head/textproc/py-docutils/files/patch-docutils-nodes.py   (contents, props changed)
  head/textproc/py-docutils/files/patch-docutils-utils-__init__.py   (contents, props changed)
Modified:
  head/textproc/py-docutils/Makefile

Modified: head/textproc/py-docutils/Makefile
==============================================================================
--- head/textproc/py-docutils/Makefile	Sun Aug  4 04:27:35 2019	(r508052)
+++ head/textproc/py-docutils/Makefile	Sun Aug  4 04:31:14 2019	(r508053)
@@ -3,6 +3,7 @@
 
 PORTNAME=	docutils
 PORTVERSION=	0.15
+PORTREVISION=	1
 CATEGORIES=	textproc python
 MASTER_SITES=	CHEESESHOP
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}

Added: head/textproc/py-docutils/files/patch-docutils-nodes.py
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/textproc/py-docutils/files/patch-docutils-nodes.py	Sun Aug  4 04:31:14 2019	(r508053)
@@ -0,0 +1,43 @@
+Obtained from:  https://sourceforge.net/p/docutils/code/8294/
+
+--- docutils/nodes.py.orig	2019-04-07 08:08:41 UTC
++++ docutils/nodes.py
+@@ -29,8 +29,6 @@ import warnings
+ import types
+ import unicodedata
+ 
+-import docutils.utils
+-
+ # ==============================
+ #  Functional Node Base Classes
+ # ==============================
+@@ -322,6 +320,20 @@ def ensure_str(s):
+         return s.encode('ascii', 'backslashreplace')
+     return s
+ 
++# definition moved here from `utils` to avoid circular import dependency
++def unescape(text, restore_backslashes=False, respect_whitespace=False):
++    """
++    Return a string with nulls removed or restored to backslashes.
++    Backslash-escaped spaces are also removed.
++    """
++    # `respect_whitespace` is ignored (since introduction 2016-12-16)
++    if restore_backslashes:
++        return text.replace('\x00', '\\')
++    else:
++        for sep in ['\x00 ', '\x00\n', '\x00']:
++            text = ''.join(text.split(sep))
++        return text
++
+ 
+ class Text(Node, reprunicode):
+ 
+@@ -364,7 +376,7 @@ class Text(Node, reprunicode):
+         return domroot.createTextNode(unicode(self))
+ 
+     def astext(self):
+-        return reprunicode(docutils.utils.unescape(self))
++        return reprunicode(unescape(self))
+ 
+     # Note about __unicode__: The implementation of __unicode__ here,
+     # and the one raising NotImplemented in the superclass Node had

Added: head/textproc/py-docutils/files/patch-docutils-utils-__init__.py
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/textproc/py-docutils/files/patch-docutils-utils-__init__.py	Sun Aug  4 04:31:14 2019	(r508053)
@@ -0,0 +1,32 @@
+Obtained from:  https://sourceforge.net/p/docutils/code/8294/
+
+--- docutils/utils/__init__.py.orig	2019-04-07 08:08:42 UTC
++++ docutils/utils/__init__.py
+@@ -18,6 +18,7 @@ import warnings
+ import unicodedata
+ from docutils import ApplicationError, DataError, __version_info__
+ from docutils import nodes
++from docutils.nodes import unescape
+ import docutils.io
+ from docutils.utils.error_reporting import ErrorOutput, SafeString
+ 
+@@ -576,18 +577,7 @@ def escape2null(text):
+         parts.append('\x00' + text[found+1:found+2])
+         start = found + 2               # skip character after escape
+ 
+-def unescape(text, restore_backslashes=False, respect_whitespace=False):
+-    """
+-    Return a string with nulls removed or restored to backslashes.
+-    Backslash-escaped spaces are also removed.
+-    """
+-    # `respect_whitespace` is ignored (since introduction 2016-12-16)
+-    if restore_backslashes:
+-        return text.replace('\x00', '\\')
+-    else:
+-        for sep in ['\x00 ', '\x00\n', '\x00']:
+-            text = ''.join(text.split(sep))
+-        return text
++# `unescape` definition moved to `nodes` to avoid circular import dependency.
+ 
+ def split_escaped_whitespace(text):
+     """



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201908040431.x744VEpl058449>