[Zope-CVS] CVS: Packages/zpkgtools/zpkgtools/appsupport - README.txt.in:1.1 configure.in:1.1

Fred L. Drake, Jr. fred at zope.com
Thu Apr 15 14:59:57 EDT 2004


Update of /cvs-repository/Packages/zpkgtools/zpkgtools/appsupport
In directory cvs.zope.org:/tmp/cvs-serv5529/appsupport

Added Files:
	README.txt.in configure.in 
Log Message:
start at making applications use the configure/make/make install pattern


=== Added File Packages/zpkgtools/zpkgtools/appsupport/README.txt.in ===
This is @PACKAGE_FULL_NAME@ @PACKAGE_VERSION at .

To build @PACKAGE_FULL_NAME@, run "./configure" in this directory.
Use "./configure --help" to learn about useful command-line options.

Once you've run the ./configure script, run the command "make" to
build the software.

To install @PACKAGE_FULL_NAME@, run the command "make install".
You may need to have root priviledges to do this, depending on where
you're installing it.  The default location is
/usr/local/@PACKAGE_SHORT_NAME at -@PACKAGE_VERSION at .


=== Added File Packages/zpkgtools/zpkgtools/appsupport/configure.in ===
#!/bin/sh

# Generic Python application configure script for Unix

PACKAGE_NAME='@PACKAGE_SHORT_NAME@'
PACKAGE_LABEL="$PACKAGE_NAME- at PACKAGE_VERSION@"

DEFAULT_PREFIX="/usr/local/$PACKAGE_LABEL"
prefix="$DEFAULT_PREFIX"


#########################################################################
# XXX The code that searches for an "acceptable" Python is really evil  #
# and doesn't make much sense for a general packaging tool.  Wee        #
# really need to find a better way to deal with this; it may be that    #
# we should simply look for several executable names, and use the       #
# first one we find.  If the installer wants something else, they can   #
# use --with-python.                                                    #
#########################################################################


# Place the optimal target version number (as returned by sys.version)
# below
TARGET="2.3.3"

# Order a list of "acceptable" python version numbers (as returned by
# sys.version) below in "best" to "worst" order, not including the
# target version.  Up to six acceptable python versions are allowed.
# Do not include the target version number in this list!
ACCEPTABLE="2.3.3 2.3.2 2.3.1 2.3"

# provide the executable names for all the acceptable versions
# (and the target version) below
EXENAMES="python python2 python2.3"


# where are we?
HERE="`dirname $0`"

# should we be quiet?
QUIET=""

usage()
{
    echo
    echo "configure [--help] [--quiet] [--with-python=path] [--prefix=path] "
    #echo "          [--ignore-largefile] [--ignore-zlib]"
    echo
    echo "Create a Makefile suitable for building @PACKAGE_FULL_NAME@"
    echo
    echo "Options: "
    echo " --help              shows usage and quits"
    echo " --quiet             suppress nonessential output"
    echo " --with-python       specify a path to a Python interpreter to use"
    echo " --prefix            specify an installation path for binary data"
    #echo " --ignore-largefile  ignore large file support warnings"
    #echo " --ignore-zlib       ignore warnings about zlib"
    echo
    echo "Given no options, configure will search your PATH for a suitable"
    echo "Python interpreter and use '$DEFAULT_PREFIX' as a prefix."
    echo
}

# bootstrap ourselves by finding a Python interpreter if necessary
get_python() {
    OLDIFS="$IFS"
    # Why are we playing with the IFS like this???
    IFS=":"
    FOUND=""
    VERSION=""
    FOUNDLIST=""
    out "Testing for an acceptable Python interpreter..."
    out ""
    for DIR in $PATH; do
        IFS="$OLDIFS"
        for EXECUTABLE in $EXENAMES; do
            FULL="$DIR/$EXECUTABLE"
            if [ -x "$FULL" ]; then
                CMD="import string,sys;a=string.split(sys.version)[0]"
		# Strip trailing + from version number
		CMD="$CMD;a=(a[-1]=='+')and(a[:-1])or(a);print a"
                VERSION=`"$FULL" -c "$CMD"`
                out "  Python version $VERSION found at $FULL"
                if [ "$VERSION" = "$TARGET" ]; then
                    FOUND="$FULL"
                    FOUNDVERSION=$VERSION
                    break 2
                else
                    i=1;
                    for ACC in $ACCEPTABLE; do
                        i=`expr $i + 1`
			for SLOT in $FOUNDLIST; do
                            if [ $SLOT -eq $i ]; then
                                # slot "i" already populated.  This means we've
                                # already found this particular version of
                                # python.  Continue the for ACC in 
                                # $ACCEPTABLE loop and don't overwrite the
                                # one we already found (interpreters first
                                # on the path win).
                                continue 2
                            fi
                        done
                        if [ "$VERSION" = "$ACC" ]; then
                            FOUNDLIST="$FOUNDLIST $i"
                            eval "FOUND$i=$FULL"
                            eval "FOUNDVERSION$i=$VERSION"
                        fi
                    done
                fi
            fi
        done
    done
    if [ "$VERSION" = "$TARGET" ]; then
        out
        out "  The optimum Python version ($TARGET) was found at $FOUND."
    elif [ -z "$FOUND1" ] && [ -z "$FOUND2" ] && [ -z "$FOUND3" ] &&
         [ -z "$FOUND4" ] && [ -z "$FOUND5" ] && [ -z "$FOUND6" ] ; then
        out
        out "  No suitable Python version found.  You should install"
        out "  Python version $TARGET before continuing.  Versions"
        out "  $ACCEPTABLE also work, but not as optimally."
        exit 1
    else
        if   [ -n "$FOUND1" ]; then
            FOUND=$FOUND1
            FOUNDVERSION=$FOUNDVERSION1
        elif [ -n "$FOUND2" ]; then
            FOUND=$FOUND2
            FOUNDVERSION=$FOUNDVERSION2
        elif [ -n "$FOUND3" ]; then
            FOUND=$FOUND3
            FOUNDVERSION=$FOUNDVERSION3
        elif [ -n "$FOUND4" ]; then
            FOUND=$FOUND4
            FOUNDVERSION=$FOUNDVERSION4
        elif [ -n "$FOUND5" ]; then
            FOUND=$FOUND5
            FOUNDVERSION=$FOUNDVERSION5
        elif [ -n "$FOUND6" ]; then
            FOUND=$FOUND6
            FOUNDVERSION=$FOUNDVERSION6
        fi
        out
        out "  !! WARNING !!"
        out "  An acceptable, but non-optimal Python version ($FOUNDVERSION)"
        out "  was found at '$FOUND'."
        out "  But consider installing version '$TARGET' before running"
        out "  'make'.  If this isn't the Python version or interpreter"
        out "  instance you wish to use, you may specify a Python interpreter"
        out "  manually by rerunning the ./configure script with the"
        out "  '--with-python' option."
    fi
    out ""
}

out() {
    if [ -z "$QUIET" ]; then
        echo $1
    fi
}


while [ "$1" ] ; do
    OPT="$1"
    shift 1
    case "$OPT" in
    --help | --hel | --he | --h | -h)
        usage
        exit 0
        ;;
    --with-python=* | --with-pytho=* | --with-pyth=* | --with-pyt=* )
        FOUND=`echo $OPT | sed -e 's/--[^=]=//'`
        # use eval to do tilde expansion
        eval "FOUND='$FOUND'"
        out ""
        out "Using Python interpreter at $FOUND"
        ;;
    --with-python | --with-pytho | --with-pyth | --with-pyt )
        FOUND="$1"
        shift 1
        out ""
        out "Using Python interpreter at $FOUND"
        ;;
    --quiet | --quie | --qui | --qu | --q | -q)
        QUIET="true"
        ;;
    --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=* )
        prefix=`echo $OPT | sed -e 's/--[^=]=//'`
        # use eval to do tilde expansion
        eval "prefix='$prefix'"
        ;;
    --prefix | --prefi | --pref | --pre | --pr | --p )
        prefix="$1"
        shift 1
        ;;
    *)
        ;;
    esac
done

out ""
out "Configuring @PACKAGE_FULL_NAME@ installation"
out ""

if [ -z "$FOUND" ]; then
    get_python
fi

sed -e "s|@prefix@|$prefix|g" \
    -e "s|@PYTHON@|$FOUND|g" \
    "$HERE/Makefile" > "$HERE/Makefile.in"

exit $?




More information about the Zope-CVS mailing list