mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 01:39:16 -04:00
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.
This commit is contained in:
parent
4216e6746d
commit
2d21f87b49
3 changed files with 119 additions and 1 deletions
|
@ -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}
|
TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}testtools>=0:devel/py-testtools@${PY_FLAVOR}
|
||||||
|
|
||||||
USES= gettext python shebangfix
|
USES= gettext python shebangfix
|
||||||
USE_PYTHON= autoplist concurrent distutils
|
USE_PYTHON= autoplist cython concurrent distutils
|
||||||
|
|
||||||
SHEBANG_FILES= brz
|
SHEBANG_FILES= brz
|
||||||
MAKE_ENV= BRZ_LOG=/dev/null
|
MAKE_ENV= BRZ_LOG=/dev/null
|
||||||
|
@ -42,6 +42,7 @@ SFTP_RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}paramiko>=0:security/py-paramiko@${PY_F
|
||||||
|
|
||||||
post-patch:
|
post-patch:
|
||||||
@${REINPLACE_CMD} -e 's|man/man1|share/man/man1|' ${WRKSRC}/setup.py
|
@${REINPLACE_CMD} -e 's|man/man1|share/man/man1|' ${WRKSRC}/setup.py
|
||||||
|
@${RM} ${WRKSRC}/breezy/*_pyx.c ${WRKSRC}/breezy/bzr/*_pyx.c
|
||||||
|
|
||||||
post-install:
|
post-install:
|
||||||
${INSTALL_MAN} ${WRKSRC}/brz.1 ${STAGEDIR}${PREFIX}/share/man/man1
|
${INSTALL_MAN} ${WRKSRC}/brz.1 ${STAGEDIR}${PREFIX}/share/man/man1
|
||||||
|
|
35
devel/brz/files/patch-breezy___rio__py.py
Normal file
35
devel/brz/files/patch-breezy___rio__py.py
Normal file
|
@ -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
|
82
devel/brz/files/patch-breezy___rio__pyx.pyx
Normal file
82
devel/brz/files/patch-breezy___rio__pyx.pyx
Normal file
|
@ -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):
|
Loading…
Add table
Reference in a new issue