aboutsummaryrefslogtreecommitdiff
path: root/www/py-cherrypy/Makefile
blob: 8c83d0f6cc7d0bdc308d07d46aea3202770d632b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Created by: Nicola Vitale	<nivit@email.it>
# $FreeBSD$

PORTNAME=	cherrypy
PORTVERSION=	5.4.0
PORTREVISION=	2
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

EXAMPLES_RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}cheetah>=2.4.4:devel/py-cheetah@${PY_FLAVOR} \
			${PYTHON_PKGNAMEPREFIX}sqlobject>=1.5.1:databases/py-sqlobject@${PY_FLAVOR}
EXAMPLESDIR=	${PREFIX}/share/examples/${PKGNAMEPREFIX}${PORTNAME}

OPTIONS_DEFINE=	EXAMPLES

PORTEXAMPLES=	*

USES=		python shebangfix
USE_PYTHON=	distutils autoplist concurrent
SHEBANG_FILES=	cherrypy/cherryd

.include <bsd.port.options.mk>

# 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 '99,106d' -e '78s/"cherrypy.tutorial",//1' \
		-e '88d' -i.bak ${WRKSRC}/${PYSETUP}

.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

.include <bsd.port.pre.mk>

.if ${PYTHON_REL} >= 3000    # devel/py-cheetah doesn't yet build with Python 3
.undef EXAMPLES_RUN_DEPENDS
.endif

# 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} >= 3000
	@(cd ${WRKSRC}/cherrypy && ${RM} _cpcompat_subprocess.py && \
	cd wsgiserver && ${RM} ssl_pyopenssl.py wsgiserver2.py)
.else
	@${RM} ${WRKSRC}/cherrypy/wsgiserver/wsgiserver3.py
.endif

.include <bsd.port.post.mk>