diff --git a/www/py-cherrypy/Makefile b/www/py-cherrypy/Makefile index 9e9c1b357292..18393c8fce00 100644 --- a/www/py-cherrypy/Makefile +++ b/www/py-cherrypy/Makefile @@ -1,53 +1,58 @@ # Created by: Nicola Vitale PORTNAME= cherrypy PORTVERSION= 17.4.2 +PORTREVISION= 1 CATEGORIES= www python MASTER_SITES= CHEESESHOP PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} DISTNAME= CherryPy-${PORTVERSION} MAINTAINER= nivit@FreeBSD.org COMMENT= Pythonic, object-oriented web development framework LICENSE= BSD3CLAUSE BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pip>0:devel/py-pip@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}setuptools_scm>0:devel/py-setuptools_scm@${PY_FLAVOR} - -EXAMPLES_RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}sqlobject>=1.5.1:databases/py-sqlobject@${PY_FLAVOR} \ - ${PYTHON_PKGNAMEPREFIX}cheetah3>0:devel/py-cheetah3@${PY_FLAVOR} -EXAMPLESDIR= ${PREFIX}/share/examples/${PKGNAMEPREFIX}${PORTNAME} - RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}six>=1.11.0:devel/py-six@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}cheroot>=6.2.4:www/py-cheroot@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}portend>=2.1.1:net/py-portend@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}zclockfile>0:devel/py-zclockfile@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}more-itertools>0:devel/py-more-itertools@${PY_FLAVOR} +TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pytest>=2.8:devel/py-pytest@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}path.py>0:devel/py-path.py@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}requests-toolbelt>0:www/py-requests-toolbelt@${PY_FLAVOR} -OPTIONS_DEFINE= EXAMPLES +USES= python:3.6+ +USE_PYTHON= distutils autoplist concurrent + +TEST_ENV= PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR} +NO_ARCH= yes PORTEXAMPLES= * -USES= python:3.6+ -USE_PYTHON= distutils autoplist concurrent +OPTIONS_DEFINE= EXAMPLES -.include +EXAMPLES_RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}sqlobject>=1.5.1:databases/py-sqlobject@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}cheetah3>0:devel/py-cheetah3@${PY_FLAVOR} -.if ${PORT_OPTIONS:MEXAMPLES} -post-install: +post-install-EXAMPLES-on: @${MKDIR} ${STAGEDIR}${EXAMPLESDIR} (cd ${WRKSRC}/cherrypy/tutorial && \ ${COPYTREE_SHARE} . ${STAGEDIR}${EXAMPLESDIR}) (cd ${STAGEDIR}${PREFIX} && \ ${PYTHON_CMD} ${PYTHON_LIBDIR}/compileall.py \ -d ${EXAMPLESDIR} ${EXAMPLESDIR:S,${PREFIX}/,,}) -.endif - -.include - -.if ${PYTHON_REL} < 3800 -RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}contextlib2>0:devel/py-contextlib2@${PY_FLAVOR} -.endif -.include +# Some tests fails with Python 3.6/3.7/3.8/3.9 and are omitted for now. +# This should be revised once the ports gets updated to a newer release. +do-test: + @cd ${TEST_WRKSRC} && ${SETENV} ${TEST_ENV} ${PYTHON_CMD} -m pytest -v -rs \ + -o addopts='' \ + -k 'not test_HTTP11_Timeout_after_request \ + and not test_threadlocal_garbage \ + and not test_null_bytes \ + and not testCombinedTools' + +.include diff --git a/www/py-cherrypy/files/patch-cherrypy_lib_sessions.py b/www/py-cherrypy/files/patch-cherrypy_lib_sessions.py new file mode 100644 index 000000000000..8130d1130c5c --- /dev/null +++ b/www/py-cherrypy/files/patch-cherrypy_lib_sessions.py @@ -0,0 +1,27 @@ +Remove contextlib2 and use contextlib from the standard library. + +* Contextlib has been in the Python standard library since Python 3.2. +* Contextlib2 is a backport to Python 2 (and is supported through Python 3.7). + +Obtained from: https://github.com/cherrypy/cherrypy/commit/2fc78dc9af3e + +--- cherrypy/lib/sessions.py.orig 2021-04-22 13:06:39 UTC ++++ cherrypy/lib/sessions.py +@@ -109,7 +109,7 @@ import binascii + + import six + from six.moves import cPickle as pickle +-import contextlib2 ++import contextlib + + import zc.lockfile + +@@ -572,7 +572,7 @@ class FileSession(Session): + def release_lock(self, path=None): + """Release the lock on the currently-loaded session data.""" + self.lock.close() +- with contextlib2.suppress(FileNotFoundError): ++ with contextlib.suppress(FileNotFoundError): + os.remove(self.lock._path) + self.locked = False + diff --git a/www/py-cherrypy/files/patch-setup.py b/www/py-cherrypy/files/patch-setup.py new file mode 100644 index 000000000000..d06d636f7de7 --- /dev/null +++ b/www/py-cherrypy/files/patch-setup.py @@ -0,0 +1,17 @@ +Remove contextlib2 and use contextlib from the standard library. + +* Contextlib has been in the Python standard library since Python 3.2. +* Contextlib2 is a backport to Python 2 (and is supported through Python 3.7). + +Obtained from: https://github.com/cherrypy/cherrypy/commit/2fc78dc9af3e + +--- setup.py.orig 2021-04-22 13:05:31 UTC ++++ setup.py +@@ -66,7 +66,6 @@ params = dict( + 'portend>=2.1.1', + 'more_itertools', + 'zc.lockfile', +- 'contextlib2', + ], + extras_require={ + 'docs': [