git: 40d7b487381c - main - Mk: add framework support for two digit python minor version
Dmitry Marakasov
amdmi3 at FreeBSD.org
Tue May 25 13:58:26 UTC 2021
The branch main has been updated by amdmi3:
URL: https://cgit.FreeBSD.org/ports/commit/?id=40d7b487381cc91eb3156103e6ffe8c02d5e8a70
commit 40d7b487381cc91eb3156103e6ffe8c02d5e8a70
Author: Dmitry Marakasov <amdmi3 at FreeBSD.org>
AuthorDate: 2021-04-09 23:16:29 +0000
Commit: Dmitry Marakasov <amdmi3 at FreeBSD.org>
CommitDate: 2021-05-25 13:55:44 +0000
Mk: add framework support for two digit python minor version
PR: 255013
Differential Revision: https://reviews.freebsd.org/D29418
Exp-run by: antoine
Approved by: wen@, no objection from python@ or portmgr@
---
Mk/Uses/python.mk | 31 ++++++++++++++++++-------------
1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/Mk/Uses/python.mk b/Mk/Uses/python.mk
index 425ff113a748..aaece9e92c2e 100644
--- a/Mk/Uses/python.mk
+++ b/Mk/Uses/python.mk
@@ -337,23 +337,28 @@ _PYTHON_ARGS= 3.6+
.endif
# Validate Python version whether it meets the version restriction.
-_PYTHON_VERSION_CHECK:= ${_PYTHON_ARGS:C/^([1-9]\.[0-9])$/\1-\1/}
-_PYTHON_VERSION_MINIMUM_TMP:= ${_PYTHON_VERSION_CHECK:C/([1-9]\.[0-9])[-+].*/\1/}
-_PYTHON_VERSION_MINIMUM:= ${_PYTHON_VERSION_MINIMUM_TMP:M[1-9].[0-9]}
-_PYTHON_VERSION_MAXIMUM_TMP:= ${_PYTHON_VERSION_CHECK:C/.*-([1-9]\.[0-9])/\1/}
-_PYTHON_VERSION_MAXIMUM:= ${_PYTHON_VERSION_MAXIMUM_TMP:M[1-9].[0-9]}
+_PYTHON_VERSION_CHECK:= ${_PYTHON_ARGS:C/^([1-9]\.[1-9]?[0-9])$/\1-\1/}
+_PYTHON_VERSION_MINIMUM_TMP:= ${_PYTHON_VERSION_CHECK:C/([1-9]\.[1-9]?[0-9])[-+].*/\1/}
+_PYTHON_VERSION_MINIMUM:= ${_PYTHON_VERSION_MINIMUM_TMP:M[1-9].[0-9]}${_PYTHON_VERSION_MINIMUM_TMP:M[1-9].[1-9][0-9]}
+_PYTHON_VERSION_MAXIMUM_TMP:= ${_PYTHON_VERSION_CHECK:C/.*-([1-9]\.[1-9]?[0-9])/\1/}
+_PYTHON_VERSION_MAXIMUM:= ${_PYTHON_VERSION_MAXIMUM_TMP:M[1-9].[0-9]}${_PYTHON_VERSION_MAXIMUM_TMP:M[1-9].[1-9][0-9]}
# At this point we should have no argument left in ${_PYTHON_ARGS}
# except a version spec
-_PYTHON_ARGS:= ${_PYTHON_ARGS:N[1-9].[0-9]-[1-9].[0-9]:N[1-9].[0-9]:N[1-9].[0-9]+:N-[1-9].[0-9]}
+_V1= [1-9].[0-9]
+_V2= [1-9].[1-9][0-9]
+_PYTHON_ARGS:= ${_PYTHON_ARGS:N${_V1}-${_V1}:N${_V1}-${_V2}:N${_V2}-${_V2}:N${_V1}:N${_V2}:N${_V1}+:N${_V2}+:N-${_V1}:N-${_V2}}
.if !empty(_PYTHON_ARGS)
IGNORE= uses unknown USES=python arguments: ${_PYTHON_ARGS}
.endif
+# Pattern to convert python versions (X.Y or X.YY) to comparable format X.YY
+_VC= C/^([1-9]\.)([0-9])$$/\10\2/
+
.undef _PYTHON_VERSION_NONSUPPORTED
-.if !empty(_PYTHON_VERSION_MINIMUM) && (${_PYTHON_VERSION} < ${_PYTHON_VERSION_MINIMUM})
+.if !empty(_PYTHON_VERSION_MINIMUM) && (${_PYTHON_VERSION:${_VC}} < ${_PYTHON_VERSION_MINIMUM:${_VC}})
_PYTHON_VERSION_NONSUPPORTED= ${_PYTHON_VERSION_MINIMUM} at least
-.elif !empty(_PYTHON_VERSION_MAXIMUM) && (${_PYTHON_VERSION} > ${_PYTHON_VERSION_MAXIMUM})
+.elif !empty(_PYTHON_VERSION_MAXIMUM) && (${_PYTHON_VERSION:${_VC}} > ${_PYTHON_VERSION_MAXIMUM:${_VC}})
_PYTHON_VERSION_NONSUPPORTED= ${_PYTHON_VERSION_MAXIMUM} at most
.endif
@@ -364,9 +369,9 @@ _PYTHON_VERSION_NONSUPPORTED= ${_PYTHON_VERSION_MAXIMUM} at most
__VER= ${ver}
.if !defined(_PYTHON_VERSION) && \
!(!empty(_PYTHON_VERSION_MINIMUM) && ( \
- ${__VER} < ${_PYTHON_VERSION_MINIMUM})) && \
+ ${__VER:${_VC}} < ${_PYTHON_VERSION_MINIMUM:${_VC}})) && \
!(!empty(_PYTHON_VERSION_MAXIMUM) && ( \
- ${__VER} > ${_PYTHON_VERSION_MAXIMUM}))
+ ${__VER:${_VC}} > ${_PYTHON_VERSION_MAXIMUM:${_VC}}))
_PYTHON_VERSION= ${ver}
.endif
.endfor
@@ -381,9 +386,9 @@ IGNORE= needs an unsupported version of Python
. for ver in ${PYTHON_DEFAULT} ${PYTHON2_DEFAULT} ${PYTHON3_DEFAULT} ${_PYTHON_VERSIONS}
__VER= ${ver}
. if !(!empty(_PYTHON_VERSION_MINIMUM) && ( \
- ${__VER} < ${_PYTHON_VERSION_MINIMUM})) && \
+ ${__VER:${_VC}} < ${_PYTHON_VERSION_MINIMUM:${_VC}})) && \
!(!empty(_PYTHON_VERSION_MAXIMUM) && ( \
- ${__VER} > ${_PYTHON_VERSION_MAXIMUM}))
+ ${__VER:${_VC}} > ${_PYTHON_VERSION_MAXIMUM:${_VC}}))
. if empty(_VALID_PYTHON_VERSIONS:M${ver})
_VALID_PYTHON_VERSIONS+= ${ver}
. endif
@@ -416,7 +421,7 @@ FLAVOR= ${FLAVORS:[1]}
. endif
.endif
-.if ${FLAVOR:Mpy[23][0-9]}
+.if ${FLAVOR:Mpy[23][0-9]}${FLAVOR:Mpy[23][1-9][0-9]}
_PYTHON_VERSION= ${FLAVOR:S/py//:C/(.)/\1./}
.endif
More information about the dev-commits-ports-all
mailing list