Git development
 help / color / mirror / Atom feed
From: Dennis Stosberg <dennis@stosberg.net>
To: git@vger.kernel.org
Subject: [PATCH 2/4] configure: Add test for Python
Date: Fri, 07 Jul 2006 18:26:40 +0200	[thread overview]
Message-ID: <20060707162640.25746.45482.stgit@leonov.stosberg.net> (raw)
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

  parent reply	other threads:[~2006-07-07 16:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-07 16:25 [PATCH 0/4] More tests for hand-written configure (resend) Dennis Stosberg
2006-07-07 16:26 ` [PATCH 1/4] configure: Add test for Perl Dennis Stosberg
2006-07-07 16:26 ` Dennis Stosberg [this message]
2006-07-07 16:26 ` [PATCH 3/4] configure: Try to figure out compiler options Dennis Stosberg
2006-07-07 16:26 ` [PATCH 4/4] configure: Fixes for Solaris Dennis Stosberg
2006-07-07 19:40 ` [PATCH 0/4] More tests for hand-written configure (resend) Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060707162640.25746.45482.stgit@leonov.stosberg.net \
    --to=dennis@stosberg.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox