ports/54820: [PATCH] for compiling .py[co] of www/py-websvcs on do-install

Rui Lopes rui at ruilopes.com
Thu Jul 24 16:50:21 UTC 2003


>Number:         54820
>Category:       ports
>Synopsis:       [PATCH] for compiling .py[co] of www/py-websvcs on do-install
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jul 24 09:50:19 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Rui Lopes
>Release:        FreeBSD 5.1-RELEASE i386
>Organization:
>Environment:
System: FreeBSD disty 5.1-RELEASE FreeBSD 5.1-RELEASE #0: Fri Jun 6 19:30:44 WEST 2003 root at disty:/usr/obj/usr/src/sys/DEBUGGER i386


	
>Description:
You cannot compile .py files in the work directory, because when you
install the .py[co] files they will be considered invalid by Python;
so this patch will compile the files in the do-install target.

$ python -v echoServer.py 2>&1|grep SOAP
# /usr/local/lib/python2.2/site-packages/SOAP.pyc has bad mtime
                                                  ^^^^^^^^^^^^^
                                       problem is here -^
import SOAP # from /usr/local/lib/python2.2/site-packages/SOAP.py
# can't create /usr/local/lib/python2.2/site-packages/SOAP.pyc
. . .


the right behaviour is:
$ python -v echoServer.py 2>&1|grep SOAP
# /usr/local/lib/python2.2/site-packages/SOAP.pyc matches /usr/local/lib/python2.2/site-packages/SOAP.py
import SOAP # precompiled from /usr/local/lib/python2.2/site-packages/SOAP.pyc
. . .

	
>How-To-Repeat:
	
>Fix:

	

--- py-websvcs.patch begins here ---
diff -u py-websvcs.orig/Makefile py-websvcs/Makefile
--- py-websvcs.orig/Makefile	Thu Jul 24 16:48:46 2003
+++ py-websvcs/Makefile	Thu Jul 24 17:20:27 2003
@@ -23,21 +23,23 @@
 PLIST_SUB+=	PYTHON_SITELIBDIR=${PYTHON_SITELIBDIR:S,^${LOCALBASE}/,,g} \
 		EXAMPLESDIR=${EXAMPLESDIR:S,^${PREFIX}/,,g} \
 		DOCSDIR=${DOCSDIR:S,^${PREFIX}/,,g}
+NO_BUILD=	yes
 TOOLS=		interop2html
+PY_FILES=	SOAP
 
 do-patch:
 .for i in ${TOOLS}
 	@${MV} ${WRKSRC}/tools/$i.py ${WRKSRC}/tools/$i
 .endfor
 
-do-build:
-	@${PYTHON_CMD} ${PYTHON_LIBDIR}/compileall.py ${WRKSRC}
-	@${PYTHON_CMD} -O ${PYTHON_LIBDIR}/compileall.py ${WRKSRC}
-
 do-install:
 	${MKDIR} ${EXAMPLESDIR}
 	${MKDIR} ${DOCSDIR}
-	${INSTALL_DATA} ${WRKSRC}/SOAP.py* ${PYTHON_SITELIBDIR}
+.for f in ${PY_FILES}
+	${INSTALL_DATA} ${WRKSRC}/${f}.py ${PYTHON_SITELIBDIR}
+	@${PYTHON_CMD} -c "import py_compile; py_compile.compile('${PYTHON_SITELIBDIR}/${f}.py')"
+	@${PYTHON_CMD} -O -c "import py_compile; py_compile.compile('${PYTHON_SITELIBDIR}/${f}.py')"
+.endfor
 .for i in ${TOOLS}
 	${INSTALL_SCRIPT} ${WRKSRC}/tools/$i ${PREFIX}/bin
 .endfor
--- py-websvcs.patch ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list