FreeBSD Bugzilla – Attachment 251170 Details for
Bug 279478
devel/brz: Fix with newer python
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch files and build
brz.patch (text/plain), 6.08 KB, created by
fullermd
on 2024-06-02 21:38:33 UTC
(
hide
)
Description:
Patch files and build
Filename:
MIME Type:
Creator:
fullermd
Created:
2024-06-02 21:38:33 UTC
Size:
6.08 KB
patch
obsolete
>From ee246d1385effbabf74cc44f2d56aa6aee5795b9 Mon Sep 17 00:00:00 2001 >From: "Matthew D. Fuller" <fullermd@over-yonder.net> >Date: Sun, 2 Jun 2024 15:55:40 -0500 >Subject: [PATCH] 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(-) > create mode 100644 devel/brz/files/patch-breezy___rio__py.py > create mode 100644 devel/brz/files/patch-breezy___rio__pyx.pyx > >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): >-- >2.45.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
fullermd:
maintainer-approval+
Actions:
View
|
Diff
Attachments on
bug 279478
: 251170
Working