gpt4 book ai didi

build - 最高版本 Python 的 Autofoo 测试

转载 作者:行者123 更新时间:2023-12-01 13:03:12 26 4
gpt4 key购买 nike

我正在尝试让 autofoo 测试 Python 的最大 版本,而不是最小版本。示例:

AC_REQUIRE([AM_PATH_PYTHON([2.7])])

... 将针对 Python >= 2.7 进行测试,并且可能会出现/usr/bin/python3。但是,我希望它只返回 python2.7。

有没有简单的方法来做到这一点?我四处打听,到目前为止,我得到的最好答复是“重写宏”。

提前致谢!

最佳答案

1).添加到 acinclude.m4

`# my_CHECK_MAJOR_VERSION(VARIABLE, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])`  
`# ---------------------------------------------------------------------------`
`# Run ACTION-IF-TRUE if the VAR has a major version >= VERSION.`
`# Run ACTION-IF-FALSE otherwise.`
AC_DEFUN([my_CHECK_MAJOR_VERSION],
[AC_MSG_CHECKING([whether $1 $$1 major version == $2])
case $$1 in
$2*)
AC_MSG_RESULT([yes])
ifelse([$3], [$3], [:])
;;
*)
AC_MSG_RESULT([no])
ifelse([$4], , [AC_MSG_ERROR([$$1 differs from $2])], [$4])
;;
esac])

2.) 添加到 zconfigure.inz

my_CHECK_MAJOR_VERSION([PYTHON_VERSION], [2])  

3.) aclocal, automake, autoconf

就是这样。

关于build - 最高版本 Python 的 Autofoo 测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4619664/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com