From owner-freebsd-ports Fri May 31 9:20:31 2002 Delivered-To: freebsd-ports@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 393F237B409 for ; Fri, 31 May 2002 09:20:01 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g4VGK1u46521; Fri, 31 May 2002 09:20:01 -0700 (PDT) (envelope-from gnats) Received: from akaraka.yonsei.ac.kr (akaraka.yonsei.ac.kr [165.132.134.53]) by hub.freebsd.org (Postfix) with ESMTP id 8DCA237B419 for ; Fri, 31 May 2002 09:16:09 -0700 (PDT) Received: from akaraka.yonsei.ac.kr (localhost.yonsei.ac.kr [127.0.0.1]) by akaraka.yonsei.ac.kr (8.12.3/8.12.3) with ESMTP id g4VGG0Cs004844 for ; Sat, 1 Jun 2002 01:16:00 +0900 (KST) (envelope-from perky@akaraka.yonsei.ac.kr) Received: (from perky@localhost) by akaraka.yonsei.ac.kr (8.12.3/8.12.3/Submit) id g4VGFsJ0004843; Sat, 1 Jun 2002 01:15:54 +0900 (KST) Message-Id: <200205311615.g4VGFsJ0004843@akaraka.yonsei.ac.kr> Date: Sat, 1 Jun 2002 01:15:54 +0900 (KST) From: Hye-Shik Chang Reply-To: Hye-Shik Chang To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: ports/38769: bsd.python.mk: improvements for handling unknown versions Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 38769 >Category: ports >Synopsis: bsd.python.mk: improvements for handling unknown versions >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri May 31 09:20:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Hye-Shik Chang >Release: FreeBSD 5.0-CURRENT i386 >Organization: Yonsei University >Environment: System: FreeBSD akaraka.yonsei.ac.kr 5.0-CURRENT FreeBSD 5.0-CURRENT #5: Sun May 5 12:24:46 KST 2002 root@akaraka.yonsei.ac.kr:/usr/src/sys/i386/compile/JOARRA i386 >Description: - allows installing into unknown version of python when FORCE_PYTHON_VERSION=yes - allows to install the port into non-root user's own python living his home directory - add USE_PYTHON_PREFIX trigger - add PYTHON_SITELIBDIR into plist substitute list >How-To-Repeat: >Fix: --- bsd.python.mk.orig Fri May 31 23:58:09 2002 +++ bsd.python.mk Sat Jun 1 00:50:30 2002 @@ -17,9 +17,12 @@ # # The variables: # +# PYTHONBASE: Python port's installation prefix. +# default: ${LOCALBASE} +# # PYTHON_CMD: Python's command line file name, including the version # number (used for dependencies). -# default: ${LOCALBASE}/bin/${PYTHON_VERSION} +# default: ${PYTHONBASE}/bin/${PYTHON_VERSION} # # PYTHON_DISTFILE: The ${DISTFILE} for your python version. Needed for # extensions like Tkinter, py-gdbm and py-expat, which @@ -27,10 +30,10 @@ # distribution. # # PYTHON_INCLUDEDIR: Location of the Python include files. -# default: ${LOCALBASE}/include/${PYTHON_VERSION} +# default: ${PYTHONBASE}/include/${PYTHON_VERSION} # # PYTHON_LIBDIR: Base of the python library tree -# default: ${LOCALBASE}/lib/${PYTHON_VERSION} +# default: ${PYTHONBASE}/lib/${PYTHON_VERSION} # # PYTHON_PKGNAMEPREFIX: Use this as a ${PKGNAMEPREFIX} to distinguish # packages for different Python versions. @@ -72,6 +75,8 @@ # PYXML: Dependency line for the XML entension. As of Python-2.0, # this extension is in the base distribution. # +# USE_PYTHON_PREFIX: Says that the port installs in ${PYTHONBASE}. +# # USE_PYDISTUTILS: Use distutils as do-build and do-install target. # # PYDISTUTILS_BUILDARGS: Arguments to build with distutils. @@ -87,13 +92,21 @@ # currently installed version. If Python is not installed, a default # version number is substituted and the corresponding Python distribution # will be built through the dependency processing. +.if defined(PYTHON_CMD) +_PYTHON_VERSION!= ${PYTHON_CMD} -c 'import sys; print sys.version[:3]' +.else _PYTHON_VERSION!= (python -c 'import sys; print sys.version[:3]') 2> /dev/null \ || echo 2.2 +.endif PYTHON_VERSION?= python${_PYTHON_VERSION} _PYTHON_PORTVERSION= 2.2.1 PYTHON_PORTVERSION!= (${PYTHON_VERSION} -c 'import string, sys; \ print string.split(sys.version)[0]') 2> /dev/null \ || echo ${_PYTHON_PORTVERSION} +_PYTHONBASE!= (${PYTHON_VERSION} -c 'import sys; print sys.prefix') \ + 2> /dev/null || echo ${LOCALBASE} +PYTHONBASE= ${_PYTHONBASE} +PYTHON_CMD?= ${PYTHONBASE}/bin/${PYTHON_VERSION} # Python-2.2 .if ${PYTHON_VERSION} == "python2.2" @@ -154,6 +167,20 @@ PYTHON_SUFFIX= 15 PYTHON_WRKSRC= ${WRKDIR}/Python-1.5.2 +# For Python Versions in Development +.elif defined(FORCE_PYTHON_VERSION) +PYDISTUTILS= ${PYTHON_LIBDIR}/distutils/core.py:${PYTHON_PORTSDIR} +PYXML= ${PYTHON_SITELIBDIR}/_xmlplus/__init__.py:${PORTSDIR}/textproc/py-xml + +PYTHON_DISTFILE= # empty +PYTHON_PORTSDIR= # empty +PYTHON_NO_DEPENDS= YES +PYTHON_REL!= ${PYTHON_CMD} -c 'import sys; h = "%x" % sys.hexversion; \ + print h[0]+h[2]+h[4]' +PYTHON_SUFFIX!= ${PYTHON_CMD} -c 'import sys; h = "%x" % sys.hexversion; \ + print h[0]+h[2]' +PYTHON_WRKSRC= ${WRKDIR}/Python-${_PYTHON_PORTVERSION} + .else .BEGIN: @${ECHO} "Error: bad value for PYTHON_VERSION: ${PYTHON_VERSION}." @@ -166,9 +193,8 @@ @${FALSE} .endif -PYTHON_CMD= ${LOCALBASE}/bin/${PYTHON_VERSION} -PYTHON_INCLUDEDIR= ${LOCALBASE}/include/${PYTHON_VERSION} -PYTHON_LIBDIR= ${LOCALBASE}/lib/${PYTHON_VERSION} +PYTHON_INCLUDEDIR= ${PYTHONBASE}/include/${PYTHON_VERSION} +PYTHON_LIBDIR= ${PYTHONBASE}/lib/${PYTHON_VERSION} PYTHON_PKGNAMEPREFIX= py${PYTHON_SUFFIX}- PYTHON_PLATFORM!= expr ${OPSYS:L}${OSREL} : '\(.*\)\.' PYTHON_SITELIBDIR= ${PYTHON_LIBDIR}/site-packages @@ -183,14 +209,20 @@ BUILD_DEPENDS+= ${PYTHON_CMD}:${PYTHON_PORTSDIR} RUN_DEPENDS+= ${PYTHON_CMD}:${PYTHON_PORTSDIR} -.if defined(USE_PYDISTUTILS) && ${PYTHON_REL} < 200 +.if defined(USE_PYDISTUTILS) && defined(PYTHON_REL) && ${PYTHON_REL} < 200 BUILD_DEPENDS+= ${PYDISTUTILS} .endif .endif # ${PYTHON_NO_DEPENDS} == "NO" +# set prefix as python's one +.if defined(USE_PYTHON_PREFIX) +PREFIX= ${PYTHONBASE} +.endif + # pkg/PLIST substrings PLIST_SUB+= PYTHON_VERSION=${PYTHON_VERSION} \ - PYTHON_PLATFORM=${PYTHON_PLATFORM} + PYTHON_PLATFORM=${PYTHON_PLATFORM} \ + PYTHON_SITELIBDIR=lib/${PYTHON_VERSION}/site-packages # XXX Hm, should I export some of the variables above to *_ENV? >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message