Index: Mk/Uses/python.mk =================================================================== --- Mk/Uses/python.mk +++ Mk/Uses/python.mk @@ -252,6 +252,11 @@ # Determine version number of Python to use .include "${PORTSDIR}/Mk/bsd.default-versions.mk" +# Load cached information about installed python if it is available +.if exists (${LOCALBASE}/share/python/vitals.mk) +.include "${LOCALBASE}/share/python/vitals.mk" +.endif + .if defined(PYTHON_DEFAULT_VERSION) WARNING+= "PYTHON_DEFAULT_VERSION is defined, consider using DEFAULT_VERSIONS=python=${PYTHON_DEFAULT_VERSION:S/^python//} instead" .endif @@ -262,20 +267,28 @@ WARNING+= "PYTHON3_DEFAULT_VERSION is defined, consider using DEFAULT_VERSIONS=python3=${PYTHON3_DEFAULT_VERSION:S/^python//} instead" .endif -.if exists(${LOCALBASE}/bin/python) -.if !defined(_PYTHON_DEFAULT_VERSION) +.if defined(METAPY_INSTALLED_VERSION) +_PYTHON_DEFAULT_VERSION= ${METAPY_INSTALLED_VERSION} +.else +. if exists(${LOCALBASE}/bin/python) +. if !defined(_PYTHON_DEFAULT_VERSION) _PYTHON_DEFAULT_VERSION!= (${LOCALBASE}/bin/python -c \ 'import sys; print("%d.%d" % sys.version_info[:2])' 2> /dev/null \ || ${ECHO_CMD} ${_PYTHON_PORTBRANCH}) | ${TAIL} -1 +. endif +. else +.undef _PYTHON_DEFAULT_VERSION +PYTHON_DEFAULT_VERSION= python${PYTHON_DEFAULT} +. endif .endif + +.if defined(_PYTHON_DEFAULT_VERSION) # python is already installed _EXPORTED_VARS+= _PYTHON_DEFAULT_VERSION +PYTHON_DEFAULT_VERSION= python${_PYTHON_DEFAULT_VERSION} .if defined(PYTHON_DEFAULT) && (${PYTHON_DEFAULT} != ${_PYTHON_DEFAULT_VERSION}) WARNING+= "Your requested default python version ${PYTHON_DEFAULT} is different from the installed default python interpreter version ${_PYTHON_DEFAULT_VERSION}" .endif -PYTHON_DEFAULT_VERSION= python${_PYTHON_DEFAULT_VERSION} -.else -PYTHON_DEFAULT_VERSION= python${PYTHON_DEFAULT} -.endif # exists(${LOCALBASE}/bin/python) +.endif # Is only a meta-port version defined? .if ${PYTHON_DEFAULT_VERSION} == "python2" @@ -388,7 +401,7 @@ # Protect partial checkouts from Mk/Scripts/functions.sh:export_ports_env(). .if !defined(_PORTS_ENV_CHECK) || exists(${PYTHON_PORTSDIR}) .if !defined(PYTHON_PORTVERSION) -PYTHON_PORTVERSION!= ${MAKE} -V PORTVERSION -C ${PYTHON_PORTSDIR} +.include "${PYTHON_PORTSDIR}/Makefile.version"; .endif _EXPORTED_VARS+= PYTHON_PORTVERSION .endif @@ -405,8 +418,16 @@ .endif .if !defined(PYTHONBASE) +.if defined(METAPY_BASE) +PYTHONBASE= ${METAPY_BASE} +.else +. if defined(_PYTHON_DEFAULT_VERSION) # python is definitely installed PYTHONBASE!= (${PYTHON_CMD} -c 'import sys; print(sys.prefix)' \ 2> /dev/null || ${ECHO_CMD} ${LOCALBASE}) | ${TAIL} -1 +. else +PYTHONBASE= ${LOCALBASE} +. endif +.endif .endif _EXPORTED_VARS+= PYTHONBASE Index: lang/python/Makefile =================================================================== --- lang/python/Makefile +++ lang/python/Makefile @@ -3,7 +3,7 @@ PORTNAME= python PORTVERSION= ${PYTHON_DEFAULT} -PORTREVISION= 2 +PORTREVISION= 3 PORTEPOCH= 2 CATEGORIES= lang python ipv6 MASTER_SITES= # empty @@ -15,12 +15,14 @@ USES= python:run NO_BUILD= yes +VITALMK= ${STAGEDIR}${DATADIR}/vitals.mk PLIST_FILES= bin/2to3 \ bin/idle \ bin/pydoc \ bin/python \ - bin/python-config + bin/python-config \ + share/python/vitals.mk .include @@ -45,6 +47,9 @@ .endif ${LN} -sf python${PYTHON_MAJOR_VER}-config \ ${STAGEDIR}${PREFIX}/bin/python-config + ${MKDIR} ${VITALMK:H} + ${ECHO} METAPY_INSTALLED_VERSION=${PYTHON_VER} > ${VITALMK} + ${ECHO} METAPY_BASE=${PREFIX} >> ${VITALMK} # Major upgrade support PORTUPGRADE_CMD= ${LOCALBASE}/sbin/portupgrade Index: lang/python27/Makefile =================================================================== --- lang/python27/Makefile +++ lang/python27/Makefile @@ -1,7 +1,7 @@ # $FreeBSD$ PORTNAME= python27 -PORTVERSION= 2.7.10 +PORTVERSION= ${PYTHON_PORTVERSION} PORTREVISION= 1 CATEGORIES= lang python ipv6 MASTER_SITES= PYTHON/ftp/python/${PORTVERSION} @@ -70,6 +70,7 @@ UCS2_CONFIGURE_ON= --enable-unicode=ucs2 UCS4_CONFIGURE_ON= --enable-unicode=ucs4 +.include "${.CURDIR}/Makefile.version" .include # http://bugs.python.org/issue22521 Index: lang/python27/Makefile.version =================================================================== --- /dev/null +++ lang/python27/Makefile.version @@ -0,0 +1,3 @@ +# Mk/Uses/python.mk includes this file, don't remove it! + +PYTHON_PORTVERSION= 2.7.10 Index: lang/python32/Makefile =================================================================== --- lang/python32/Makefile +++ lang/python32/Makefile @@ -1,7 +1,7 @@ # $FreeBSD$ PORTNAME= python32 -PORTVERSION= 3.2.5 +PORTVERSION= ${PYTHON_PORTVERSION} PORTREVISION= 15 CATEGORIES= lang python ipv6 MASTER_SITES= PYTHON/ftp/python/${PORTVERSION} @@ -65,6 +65,7 @@ TSC_CONFIGURE_WITH= tsc UCS4_CONFIGURE_WITH= wide-unicode +.include "${.CURDIR}/Makefile.version" .include .if ${PORT_OPTIONS:MUCS4} Index: lang/python32/Makefile.version =================================================================== --- /dev/null +++ lang/python32/Makefile.version @@ -0,0 +1,3 @@ +# Mk/Uses/python.mk includes this file, don't remove it! + +PYTHON_PORTVERSION= 3.2.5 Index: lang/python33/Makefile =================================================================== --- lang/python33/Makefile +++ lang/python33/Makefile @@ -1,7 +1,7 @@ # $FreeBSD$ PORTNAME= python33 -PORTVERSION= 3.3.5 +PORTVERSION= ${PYTHON_PORTVERSION} PORTREVISION= 8 CATEGORIES= lang python ipv6 MASTER_SITES= PYTHON/ftp/python/${PORTVERSION} @@ -67,6 +67,7 @@ TSC_CONFIGURE_WITH= tsc +.include "${.CURDIR}/Makefile.version" .include .if ${PORT_OPTIONS:MPYMALLOC} Index: lang/python33/Makefile.version =================================================================== --- /dev/null +++ lang/python33/Makefile.version @@ -0,0 +1,3 @@ +# Mk/Uses/python.mk includes this file, don't remove it! + +PYTHON_PORTVERSION= 3.3.5 Index: lang/python34/Makefile =================================================================== --- lang/python34/Makefile +++ lang/python34/Makefile @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME= python34 -PORTVERSION= 3.4.3 +PORTVERSION= ${PYTHON_PORTVERSION} PORTREVISION= 2 CATEGORIES= lang python ipv6 MASTER_SITES= PYTHON/ftp/python/${PORTVERSION} @@ -78,6 +78,7 @@ TSC_CONFIGURE_WITH= tsc +.include "${.CURDIR}/Makefile.version" .include .if ${PORT_OPTIONS:MPYMALLOC} Index: lang/python34/Makefile.version =================================================================== --- /dev/null +++ lang/python34/Makefile.version @@ -0,0 +1,3 @@ +# Mk/Uses/python.mk includes this file, don't remove it! + +PYTHON_PORTVERSION= 3.4.3 Index: lang/python35/Makefile =================================================================== --- lang/python35/Makefile +++ lang/python35/Makefile @@ -2,10 +2,10 @@ # $FreeBSD$ PORTNAME= python -DISTVERSION= 3.5.0 +DISTVERSION= ${PYTHON_PORTVERSION} PORTREVISION= 1 CATEGORIES= lang python ipv6 -MASTER_SITES= PYTHON/ftp/python/${DISTVERSION:C/^([0-9]+\.[0-9]+\.[0-9]+).*/\1/} +MASTER_SITES= PYTHON/ftp/python/${PYTHON_PORTVERSION} PKGNAMESUFFIX= ${PYTHON_SUFFIX} DISTNAME= Python-${DISTVERSION} DIST_SUBDIR= python @@ -25,7 +25,6 @@ CPE_VERSION= ${DISTVERSION} # Duplicate python.mk variables. TODO: Let lang/python?? ports use python.mk bits. -PYTHON_PORTVERSION= ${DISTVERSION:C/^([0-9]+\.[0-9]+\.[0-9]+).*/\1/} PYTHON_VER= ${PYTHON_PORTVERSION:R} PYTHON_VERSION= python${PYTHON_VER} PYTHON_SUFFIX= ${PYTHON_VER:S/.//g} @@ -86,6 +85,7 @@ TSC_CONFIGURE_WITH= tsc +.include "${.CURDIR}/Makefile.version" .include .if ${PORT_OPTIONS:MPYMALLOC} Index: lang/python35/Makefile.version =================================================================== --- /dev/null +++ lang/python35/Makefile.version @@ -0,0 +1,3 @@ +# Mk/Uses/python.mk includes this file, don't remove it! + +PYTHON_PORTVERSION= 3.5.0