[Python-checkins] r41919 - python/trunk/Makefile.pre.in

Trent Mick trentm at ActiveState.com
Thu Jan 5 20:14:13 CET 2006


[Martin v. Loewis wrote]
> neal.norwitz wrote:
> > Try to make svnversion test more portable, based on Sjoerd's suggestion
> 
> That apparently doesn't work: the OSX buildbot does not have svnversion
> in its path (yet), still "which" succeeds.

I use this bash function to use which on Linux, Solaris, OSX and other Un*x:

    function is_on_path() {
        # Return 0 if the command is found on the PATH, non-zero otherwise.
        # GNU which behaves this way, some (notably on Mac OS X) don't.
        result="`\which $1`"
        if test -e "$result"; then
            #echo is_on_path\($1\) returning 0
            return 0
        else
            #echo is_on_path\($1\) returning 1
            return 1
        fi
    }

the '\' before 'which' is to NOT use aliases. I've found that sometimes which
was aliased to "type -p" or something and caused me problems... though I don't
remember the exact details.

Trent

-- 
Trent Mick
trentm at activestate.com


More information about the Python-checkins mailing list