Pregunta

Estoy intentando conseguir autofoo a prueba para un máxima versión de Python en lugar de un mínimo. Ejemplo:

AC_REQUIRE([AM_PATH_PYTHON([2.7])])

... pondrá a prueba para Python> = 2,7, y probablemente su vez con / usr / bin / python3. Quiero que vuelva nada más grande que python2.7, sin embargo.

¿Hay una forma sencilla de hacer esto? Pregunté por ahí, y hasta el momento la mejor respuesta que he recibido es "reescribir la macro."

Gracias de antemano!

¿Fue útil?

Solución

1). Añadir a 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.) Añadir a zconfigure.inz

my_CHECK_MAJOR_VERSION([PYTHON_VERSION], [2])  

3.) aclocal, automake, autoconf

Eso es todo.

Otros consejos

El argumento versión a AM_PATH_PYTHON es opcional. Si se requiere Python, lo llaman así:

AM_PATH_PYTHON

Si no se requiere, lo llaman así:

AM_PATH_PYTHON(,, [:])

Ahora, AM_PATH_PYTHON establece la variable de shell $PYTHON_VERSION al valor de sys.version[:3], que puede ponerse a prueba.

Una solución alternativa puede fijar el valor por defecto para _AM_PYTHON_INTERPRETER_LIST , para incluir sólo Python 2 binarios.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top