git: 2d21f87b49ab - main - devel/brz: Unbreak with newer python.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 10 Jun 2024 04:25:27 UTC
The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/ports/commit/?id=2d21f87b49abefa0d565e4c439b59df24edfb8aa commit 2d21f87b49abefa0d565e4c439b59df24edfb8aa Author: Matthew D. Fuller <fullermd@over-yonder.net> AuthorDate: 2024-06-02 20:55:40 +0000 Commit: Cy Schubert <cy@FreeBSD.org> CommitDate: 2024-06-10 04:25:05 +0000 devel/brz: Unbreak with newer python. This forces a cython run and brings in the patch from upstream revision the_breezy_bot-20221107175157-t17wpc8hfcwsmsa0 on the brz 3.3 branch. The 3.3 releases have significant differences in build dependancy, so are currently being held off on. --- devel/brz/Makefile | 3 +- devel/brz/files/patch-breezy___rio__py.py | 35 ++++++++++++ devel/brz/files/patch-breezy___rio__pyx.pyx | 82 +++++++++++++++++++++++++++++ 3 files changed, 119 insertions(+), 1 deletion(-) diff --git a/devel/brz/Makefile b/devel/brz/Makefile index 45968f523a59..f1df281ea870 100644 --- a/devel/brz/Makefile +++ b/devel/brz/Makefile @@ -22,7 +22,7 @@ RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}configobj>=0:devel/py-configobj@${PY_FLAVOR} TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}testtools>=0:devel/py-testtools@${PY_FLAVOR} USES= gettext python shebangfix -USE_PYTHON= autoplist concurrent distutils +USE_PYTHON= autoplist cython concurrent distutils SHEBANG_FILES= brz MAKE_ENV= BRZ_LOG=/dev/null @@ -42,6 +42,7 @@ SFTP_RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}paramiko>=0:security/py-paramiko@${PY_F post-patch: @${REINPLACE_CMD} -e 's|man/man1|share/man/man1|' ${WRKSRC}/setup.py + @${RM} ${WRKSRC}/breezy/*_pyx.c ${WRKSRC}/breezy/bzr/*_pyx.c post-install: ${INSTALL_MAN} ${WRKSRC}/brz.1 ${STAGEDIR}${PREFIX}/share/man/man1 diff --git a/devel/brz/files/patch-breezy___rio__py.py b/devel/brz/files/patch-breezy___rio__py.py new file mode 100644 index 000000000000..faaad2274ed2 --- /dev/null +++ b/devel/brz/files/patch-breezy___rio__py.py @@ -0,0 +1,35 @@ +--- breezy/_rio_py.py.orig 2021-12-07 02:24:26 UTC ++++ breezy/_rio_py.py +@@ -17,6 +17,7 @@ import re + """Python implementation of _read_stanza_*.""" + + import re ++from typing import Iterator, Optional + + from .rio import ( + Stanza, +@@ -25,13 +26,13 @@ _tag_re = re.compile(r'^[-a-zA-Z0-9_]+$') + _tag_re = re.compile(r'^[-a-zA-Z0-9_]+$') + + +-def _valid_tag(tag): ++def _valid_tag(tag: str) -> bool: + if not isinstance(tag, str): + raise TypeError(tag) + return bool(_tag_re.match(tag)) + + +-def _read_stanza_utf8(line_iter): ++def _read_stanza_utf8(line_iter: Iterator[bytes]) -> Optional[Stanza]: + stanza = Stanza() + tag = None + accum_value = None +@@ -67,7 +68,7 @@ def _read_stanza_utf8(line_iter): + accum_value = [line[colon_index + 2:-1]] + + if tag is not None: # add last tag-value +- stanza.add(tag, u''.join(accum_value)) ++ stanza.add(tag, u''.join(accum_value)) # type: ignore + return stanza + else: # didn't see any content + return None diff --git a/devel/brz/files/patch-breezy___rio__pyx.pyx b/devel/brz/files/patch-breezy___rio__pyx.pyx new file mode 100644 index 000000000000..125603cb2660 --- /dev/null +++ b/devel/brz/files/patch-breezy___rio__pyx.pyx @@ -0,0 +1,82 @@ +--- breezy/_rio_pyx.pyx.orig 2021-12-07 02:24:26 UTC ++++ breezy/_rio_pyx.pyx +@@ -31,10 +31,6 @@ from cpython.unicode cimport ( + from cpython.unicode cimport ( + PyUnicode_CheckExact, + PyUnicode_DecodeUTF8, +- # Deprecated after PEP 393 changes +- PyUnicode_AS_UNICODE, +- PyUnicode_FromUnicode, +- PyUnicode_GET_SIZE, + ) + from cpython.list cimport ( + PyList_Append, +@@ -44,15 +40,9 @@ from cpython.mem cimport ( + PyMem_Malloc, + PyMem_Realloc, + ) +-from cpython.version cimport ( +- PY_MAJOR_VERSION, +- ) + + cdef extern from "Python.h": + ctypedef int Py_UNICODE +- object PyUnicode_EncodeASCII(Py_UNICODE *, int, char *) +- int Py_UNICODE_ISLINEBREAK(Py_UNICODE) +- + # GZ 2017-09-11: Not sure why cython unicode module lacks this? + object PyUnicode_FromStringAndSize(const char *u, Py_ssize_t size) + +@@ -74,19 +64,13 @@ def _valid_tag(tag): + + + def _valid_tag(tag): +- cdef char *c_tag ++ cdef const char *c_tag + cdef Py_ssize_t c_len + cdef int i + # GZ 2017-09-11: Encapsulate native string as ascii tag somewhere neater +- if PY_MAJOR_VERSION >= 3: +- if not PyUnicode_CheckExact(tag): +- raise TypeError(tag) +- c_tag = PyUnicode_AsUTF8AndSize(tag, &c_len) +- else: +- if not PyBytes_CheckExact(tag): +- raise TypeError(tag) +- c_tag = PyBytes_AS_STRING(tag) +- c_len = PyBytes_GET_SIZE(tag) ++ if not PyUnicode_CheckExact(tag): ++ raise TypeError(tag) ++ c_tag = PyUnicode_AsUTF8AndSize(tag, &c_len) + if c_len < 1: + return False + for i from 0 <= i < c_len: +@@ -104,27 +88,8 @@ cdef object _split_first_line_utf8(char *line, int len + raise ValueError("invalid tag in line %r" % line) + memcpy(value, line+i+2, len-i-2) + value_len[0] = len-i-2 +- if PY_MAJOR_VERSION >= 3: +- return PyUnicode_FromStringAndSize(line, i) +- return PyBytes_FromStringAndSize(line, i) ++ return PyUnicode_DecodeUTF8(line, i, "strict") + raise ValueError('tag/value separator not found in line %r' % line) +- +- +-cdef object _split_first_line_unicode(Py_UNICODE *line, int len, +- Py_UNICODE *value, Py_ssize_t *value_len): +- cdef int i +- for i from 0 <= i < len: +- if line[i] == c':': +- if line[i+1] != c' ': +- raise ValueError("invalid tag in line %r" % +- PyUnicode_FromUnicode(line, len)) +- memcpy(value, &line[i+2], (len-i-2) * sizeof(Py_UNICODE)) +- value_len[0] = len-i-2 +- if PY_MAJOR_VERSION >= 3: +- return PyUnicode_FromUnicode(line, i) +- return PyUnicode_EncodeASCII(line, i, "strict") +- raise ValueError("tag/value separator not found in line %r" % +- PyUnicode_FromUnicode(line, len)) + + + def _read_stanza_utf8(line_iter):