Skip to content

Commit d39d360

Browse files
committed
MFH: r501964 devel/py-cbor2: Remove Python 3 support restriction
This package supports Python 3.x support, so allow it accordingly. It is required for an upcoming www/py-autobahn update (Python 2/3 compatible). During QA, a UnicodeDecodeError was observed running tests under Python 3: File "/usr/local/lib/python3.6/site-packages/py/_vendored_packages/iniconfig.py", line 82, in _parse for lineno, line in enumerate(line_iter): File "/usr/local/lib/python3.6/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 165: ordinal not in range(128) pytest uses the py package, which vendors the iniconfig package, which isn't unicode aware [1][2][3]. Patch out unicode characters from setup.cfg accordingly until it's resolved. While investigating the cause of the above issue, a fix for setup.cfg's encoding was identified, which removes the need to set the locale via USE_LOCALE so remove it accordingly. While I'm here: - Pet portlint, spurious space at end of line in pkg-descr - Add LICENSE_FILE/TEST_DEPENDS/test target/NO_ARCH [1] pytest-dev/pytest#3799 [2] pytest-dev/iniconfig#5 [3] pytest-dev/iniconfig#4 portlint: OK (looks fine.) porttest: OK (poudriere: 12amd64{py36,py27}) maketest: 215 passed, 1 skipped in 3.29 seconds (Python 2.7) maketest: 209 passed, 7 skipped in 3.07 seconds (Python 3.6) Approved by: portmgr (blanket: ports/framework compliance) Approved by: ports-secteam (joneum, blanket: ports/framework compliance)
1 parent b9d3a35 commit d39d360

File tree

3 files changed

+47
-4
lines changed

3 files changed

+47
-4
lines changed

devel/py-cbor2/Makefile

+9-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
PORTNAME= cbor2
55
PORTVERSION= 4.1.2
6+
PORTREVISION= 1
67
CATEGORIES= devel python
78
MASTER_SITES= CHEESESHOP
89
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
@@ -11,12 +12,17 @@ MAINTAINER= dvl@FreeBSD.org
1112
COMMENT= Pure Python CBOR (de)serializer with extensive tag support
1213

1314
LICENSE= MIT
15+
LICENSE_FILE= ${WRKSRC}/LICENSE.txt
1416

15-
BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}setuptools_scm>0:devel/py-setuptools_scm@${PY_FLAVOR}
17+
BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}setuptools_scm>=1.7.0:devel/py-setuptools_scm@${PY_FLAVOR}
18+
TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pytest>0:devel/py-pytest@${PY_FLAVOR}
1619

17-
USES= python:2.7
20+
USES= python
1821
USE_PYTHON= autoplist concurrent distutils
1922

20-
USE_LOCALE= en_US.UTF-8
23+
NO_ARCH= yes
24+
25+
do-test:
26+
@cd ${WRKSRC} && ${PYTHON_CMD} -m pytest -v -rs
2127

2228
.include <bsd.port.mk>

devel/py-cbor2/files/patch-setup.cfg

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Added encoding declaration to setup.cfg
2+
# https://github.com/agronholm/cbor2/commit/ba05c122
3+
# https://github.com/agronholm/cbor2/issues/38
4+
5+
# pytest uses py which vendors iniconfig, which isn't unicode aware
6+
# Patch out unicode characters for now
7+
# https://github.com/pytest-dev/pytest/issues/3799
8+
# https://github.com/RonnyPfannschmidt/iniconfig/issues/5
9+
# https://github.com/RonnyPfannschmidt/iniconfig/issues/4
10+
11+
# coverage is not a compulsory dependency
12+
# this block clobbers ports pytest args
13+
14+
--- setup.cfg.orig 2018-12-10 13:39:24 UTC
15+
+++ setup.cfg
16+
@@ -1,8 +1,9 @@
17+
+# coding: utf-8
18+
[metadata]
19+
name = cbor2
20+
description = Pure Python CBOR (de)serializer with extensive tag support
21+
long_description = file: README.rst
22+
-author = Alex Grönholm
23+
+author = Alex Gronholm
24+
author_email = alex.gronholm@nextday.fi
25+
project_urls =
26+
Documentation = https://cbor2.readthedocs.org/en/latest/
27+
@@ -30,10 +31,6 @@ packages = find:
28+
test =
29+
pytest
30+
pytest-cov
31+
-
32+
-[tool:pytest]
33+
-addopts = -rsx --cov --tb=short
34+
-testpaths = tests
35+
36+
[coverage:run]
37+
source = cbor2

devel/py-cbor2/pkg-descr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ There exists another Python CBOR implementation (cbor) which is faster on
55
CPython due to its C extensions. On PyPy, cbor2 and cbor are almost identical
66
in performance. The other implementation also lacks documentation and a
77
comprehensive test suite, does not support most standard extension tags and is
8-
known to crash (segfault) when passed a cyclic structure (say, a list
8+
known to crash (segfault) when passed a cyclic structure (say, a list
99
containing itself).
1010

1111
WWW: https://pypi.org/project/cbor2/

0 commit comments

Comments
 (0)