git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/4] configure: Add test for Python

From
DSDennis Stosberg <dennis@stosberg.net>
Date
Jul 7, 2006, 16:26 UTC
Message-ID
<20060707162640.25746.45482.stgit@leonov.stosberg.net>
In-Reply-To
<20060707162513.25746.57374.stgit@leonov.stosberg.net>
From: Dennis Stosberg <dennis@stosberg.net>

The test tries to find the path to a suitable Python binary. The user can override the auto-detection with the --python parameter or with the PYTHON environment variable.

Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
---
 config-lib.sh |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/config-lib.sh b/config-lib.sh
index 34dfc05..3968245 100755
--- a/config-lib.sh
+++ b/config-lib.sh
@@ -259,6 +259,9 @@ process_params() {
 	_perl=
 	test "$PERL" && _perl="$PERL"
 
+	_python=
+	test "$PYTHON" && _python="$PYTHON"
+
 	for ac_option do
 		case "$ac_option" in
 		--help|-help|-h)
@@ -282,6 +285,7 @@ Installation directories:
 Miscellaneous options:
   --cc=COMPILER          use this C compiler to build MPlayer [gcc]
   --perl=PATH            path to perl binary [autodetect]
+  --python=PATH          path to python binary [autodetect]
   --target=PLATFORM      target platform (i386-linux, arm-linux, etc)
   --with-install=PATH    use a custom install program (useful if your OS uses
                          a GNU-incompatible install utility by default and
@@ -318,6 +322,8 @@ EOF
 			_cc=`echo $ac_option | cut -d '=' -f 2` ;;
 		--perl=*)
 			_perl=`echo $ac_option | cut -d '=' -f 2` ;;
+		--python=*)
+			_python=`echo $ac_option | cut -d '=' -f 2` ;;
 		--target=*)
 			_target=`echo $ac_option | cut -d '=' -f 2` ;;
 		--with-install=*)
@@ -445,6 +451,28 @@ EOF
 		die "your perl is too old. Perl 5.6.0 or newer is required."
 	fi
 	echores "$_perl_version"
+
+	echocheck "for python"
+	for _py_bin in python python2.4 python2.3; do
+		test "$_python" && continue
+
+		_candidate=`path_find $_py_bin`
+		test "$_candidate" || continue
+
+		$_candidate - <<EOF || continue
+import sys
+v = sys.version_info
+if v < (2, 3):
+    sys.exit(1)
+EOF
+		_python=$_candidate
+	done
+	if test "$_python"; then
+		echores "$_python"
+	else
+		_no_python="ConfigureYesPlease"
+		echores "not found"
+	fi
 }
 
 write_config() {
@@ -465,6 +493,10 @@ EOF
 		test -z $_mandir || ( echo "mandir = $_mandir" && echo "export mandir" )
 		test -z $_templatedir || echo "template_dir = $_templatedir"
 		test -z $_gitpythondir || echo "GIT_PYTHON_DIR = $_gitpythondir"
+
+		test -z $_python || echo "PYTHON_PATH = $_python"
+		test -z $_no_python || echo "NO_PYTHON = $_no_python"
+
 		echo
 		eval "$mkvars"
 	} > config.mak.autogen
Previous: Dennis StosbergNext: Dennis Stosberg
Message 3 of 6 in “More tests for hand-written configure (resend)”
  1. 0/4 More tests for hand-written configure (resend)Dennis Stosberg, Jul 7, 2006
  2. 1/4 configure: Add test for PerlDennis Stosberg, Jul 7, 2006
  3. 2/4 configure: Add test for PythonDennis Stosberg, Jul 7, 2006
  4. 3/4 configure: Try to figure out compiler optionsDennis Stosberg, Jul 7, 2006
  5. 4/4 configure: Fixes for SolarisDennis Stosberg, Jul 7, 2006
  6. Junio C HamanoJul 7, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.