Bug 186286 - [PATCH] www/py-cherrypy Update & unbreak Python3
Summary: [PATCH] www/py-cherrypy Update & unbreak Python3
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Nicola Vitale
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-30 21:30 UTC by martin
Modified: 2014-04-05 00:10 UTC (History)
0 users

See Also:


Attachments
file.diff (61.83 KB, patch)
2014-01-30 21:30 UTC, martin
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description martin 2014-01-30 21:30:00 UTC
- Update to the latest version, this solves a run-time problem with Python 3
- I've also fixed the pkg-plist so it'll work correctly for Python 2 & 3
- I've removed the tutorial examples, it requires cheetah as a dependency, which won't build on Python 3; I've tried to set NOPORTEXAMPLES=yes automagicly for Python3, but after 20 minutes of mucking about I still didn't have it working (Makefile errors which I didn't really understand)... IMHO they're not that important, but if the maintainer insist they're important, I can look at it again.

Tested with FreeBSD 10.0/Python3.3 & FreeBSD 9.2/Python2.7. Installing, deinstalling, and running works w/o errors or leftovers. Didn't test other versions of Python.

Fix: Patch attached with submission follows:
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2014-01-30 21:30:10 UTC
Responsible Changed
From-To: freebsd-ports-bugs->nivit

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 dfilter service freebsd_committer freebsd_triage 2014-04-05 00:03:40 UTC
Author: nivit
Date: Fri Apr  4 23:03:36 2014
New Revision: 350183
URL: http://svnweb.freebsd.org/changeset/ports/350183
QAT: https://qat.redports.org/buildarchive/r350183/

Log:
  - Update to 3.2.4  [1]
  - Use CHEESESHOP as only download site  [1]
  - Remove leading article from COMMENT
  - Add LICENSE (BSD3CLAUSE)
  - Deprecate easy_install
  - Use automatic pkg-plist via PYDISTUTILS_AUTOPLIST
  - Convert to the new options framework
  - Make EXAMPLES option effective only for Python ver. < 3,
    due to devel/py-cheetah at the moment only for Python 2
  - Add support for stage-dir
  - Add a post-[extract|patch] target to fix setup.py,
    otherwise *_AUTOPLIST fails
  - Fix format of WWW field in pkg-descr, and remove Author:
  
  PR:	ports/186286  [1]
  Submitted by:	Martin Tournoij <martin@arp242.net>

Deleted:
  head/www/py-cherrypy/pkg-plist
Modified:
  head/www/py-cherrypy/Makefile
  head/www/py-cherrypy/distinfo
  head/www/py-cherrypy/pkg-descr

Modified: head/www/py-cherrypy/Makefile
==============================================================================
--- head/www/py-cherrypy/Makefile	Fri Apr  4 23:01:42 2014	(r350182)
+++ head/www/py-cherrypy/Makefile	Fri Apr  4 23:03:36 2014	(r350183)
@@ -2,44 +2,64 @@
 # $FreeBSD$
 
 PORTNAME=	cherrypy
-PORTVERSION=	3.2.2
+PORTVERSION=	3.2.4
 PORTREVISION=	0
 CATEGORIES=	www python
-MASTER_SITES=	http://download.cherrypy.org/cherrypy/${PORTVERSION}/ \
-		http://nivi.interfree.it/distfiles/${PORTNAME}/
+MASTER_SITES=	CHEESESHOP
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
 DISTNAME=	CherryPy-${PORTVERSION}
 
 MAINTAINER=	nivit@FreeBSD.org
-COMMENT=	A pythonic, object-oriented web development framework
+COMMENT=	Pythonic, object-oriented web development framework
 
-.if !defined(NOPORTEXAMPLES)
-RUN_DEPENDS+=	${PYTHON_PKGNAMEPREFIX}cheetah>=2.0.1:${PORTSDIR}/devel/py-cheetah
+LICENSE=	BSD3CLAUSE
 
+EXAMPLES_RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}cheetah>=2.4.4:${PORTSDIR}/devel/py-cheetah \
+			${PYTHON_PKGNAMEPREFIX}sqlobject>=1.5.1:${PORTSDIR}/databases/py-sqlobject
 EXAMPLESDIR=	${PREFIX}/share/examples/${PKGNAMEPREFIX}${PORTNAME}
-.endif
+
+OPTIONS_DEFINE=	EXAMPLES
+
+PORTEXAMPLES=	*
+PYDISTUTILS_AUTOPLIST=	yes
 
 USE_PYTHON=	yes
-USE_PYDISTUTILS=	easy_install
-PYDISTUTILS_PKGNAME=	CherryPy
+USE_PYDISTUTILS=	yes
+
+.include <bsd.port.options.mk>
 
-PLIST_SUB=	PY2=${PY2} PYMAJORVER=${PYMAJORVER}
+# handle tutorial separately, and remove cherrypy.process from data_files
+# otherwise it confuses build_py.get_outputs() and breaks PYDISTUTILS_AUTOPLIST
+post-patch:
+	@${REINPLACE_CMD} -e '89,96d' -e '68s/"cherrypy.tutorial",//1' \
+		-e '78d' -i.bak ${WRKSRC}/${PYSETUP}
 
-PYMAJORVER=	${PYTHON_VER:R}
+.if ${PORT_OPTIONS:MEXAMPLES}
+post-install:
+	@${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
 
-NO_STAGE=	yes
 .include <bsd.port.pre.mk>
 
-post-install:
-.if !defined(NOPORTEXAMPLES)
-	${MKDIR} ${EXAMPLESDIR}
-	cd ${PYTHONPREFIX_SITELIBDIR}/${PYEASYINSTALL_EGG}/${PORTNAME} && ${COPYTREE_SHARE} tutorial ${EXAMPLESDIR}
+.if ${PYTHON_REL} >= 300    # devel/py-cheetah doesn't yet build with Python 3
+.undef EXAMPLES_RUN_DEPENDS
 .endif
-	${RM} -R ${PYTHONPREFIX_SITELIBDIR}/${PYEASYINSTALL_EGG}/${PORTNAME}/tutorial
-.if ${PYMAJORVER} == 2
-PY2=''
+
+# The package cherrypy.wsgiserver includes both Python 2 and Python 3 modules,
+# so it breaks PYDISTUTILS_AUTOPLIST.
+# Instead of defining a cherrypy_build_py.get_outputs() method in setup.py
+# we simply remove unwanted modules (see cherrypy_build_py() in setup.py)
+post-extract:
+.if ${PYTHON_REL} >= 300
+	@(cd ${WRKSRC}/cherrypy && ${RM} _cpcompat_subprocess.py && \
+	cd wsgiserver && ${RM} ssl_pyopenssl.py wsgiserver2.py)
 .else
-PY2='@comment '
+	@${RM} ${WRKSRC}/cherrypy/wsgiserver/wsgiserver3.py
 .endif
 
 .include <bsd.port.post.mk>

Modified: head/www/py-cherrypy/distinfo
==============================================================================
--- head/www/py-cherrypy/distinfo	Fri Apr  4 23:01:42 2014	(r350182)
+++ head/www/py-cherrypy/distinfo	Fri Apr  4 23:03:36 2014	(r350183)
@@ -1,2 +1,2 @@
-SHA256 (CherryPy-3.2.2.tar.gz) = dc5a88562795c2ee462dac5b37aba1cf4f34f3e27281ec11049227039308b691
-SIZE (CherryPy-3.2.2.tar.gz) = 414099
+SHA256 (CherryPy-3.2.4.tar.gz) = abd73a449936740e99d3a05eb89b9381dc188ef696904f585463bc28079f1288
+SIZE (CherryPy-3.2.4.tar.gz) = 424074

Modified: head/www/py-cherrypy/pkg-descr
==============================================================================
--- head/www/py-cherrypy/pkg-descr	Fri Apr  4 23:01:42 2014	(r350182)
+++ head/www/py-cherrypy/pkg-descr	Fri Apr  4 23:03:36 2014	(r350183)
@@ -8,5 +8,4 @@ CherryPy is now more than three years ol
 fast and stable. It is being used in production by many sites, from
 the simplest ones to the most demanding ones.
 
-Author:	CherryPy Team <team@cherrypy.org>
-WWW:	http://www.cherrypy.org/
+WWW: http://www.cherrypy.org/
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 3 Nicola Vitale freebsd_committer freebsd_triage 2014-04-05 00:05:34 UTC
State Changed
From-To: open->closed

Committed with minor changes. Thank you!