[Bps-public-commit] r10815 - Shipwright/lib/Shipwright

sunnavy at bestpractical.com sunnavy at bestpractical.com
Tue Feb 12 23:13:00 EST 2008


Author: sunnavy
Date: Tue Feb 12 23:12:59 2008
New Revision: 10815

Modified:
   Shipwright/lib/Shipwright/Backend.pm

Log:
updated shipwright env source file, we can `source shipwright-script-bash $SHIPENV` now

Modified: Shipwright/lib/Shipwright/Backend.pm
==============================================================================
--- Shipwright/lib/Shipwright/Backend.pm	(original)
+++ Shipwright/lib/Shipwright/Backend.pm	Tue Feb 12 23:12:59 2008
@@ -637,11 +637,17 @@
     ,
     source_bash => <<'EOF'
 #!/usr/bin/env bash
-if [ $# = 1 ]; then
-    export PATH=$1/bin:$PATH
-    export PERL5LIB=$1/lib/perl5/site_perl:$1/lib/perl5:${PERL5LIB}
-    export LD_LIBRARY_PATH=$1/lib:${LD_LIBRARY_PATH}
-    export DYLD_LIBRARY_PATH=$1/lib:${DYLD_LIBRARY_PATH}
+if [ $# = 1 ] || [ "$SHIPENV" != '' ]; then
+    if [ "$1" ]; then
+        BASENAME=$1;
+    else
+        DIRNAME=`dirname $SHIPENV`;
+        BASENAME="$DIRNAME/.."
+    fi
+
+    export PATH=$BASENAME/bin:$PATH
+    export PERL5LIB=$BASENAME/lib/perl5/site_perl:$BASENAME/lib/perl5:${PERL5LIB}
+    export DYLD_LIBRARY_PATH=$BASENAME/lib:${DYLD_LIBRARY_PATH}
 else
     echo 'USAGE: source shipwright-source-bash BASEPATH'
 fi
@@ -649,11 +655,38 @@
     ,
     source_tcsh => <<'EOF'
 #!/usr/bin/env tcsh
-if ( $# == 1 ) then
-    setenv PATH $1/bin:$PATH
-    setenv PERL5LIB $1/lib/perl5/site_perl:$1/lib/perl5:${PERL5LIB}
-    setenv LD_LIBRARY_PATH $1/lib:${LD_LIBRARY_PATH}
-    setenv DYLD_LIBRARY_PATH $1/lib:${DYLD_LIBRARY_PATH}
+if ( "$1" != '' || $?SHIPENV ) then
+
+    if ( $1 != '' ) then
+        set BASENAME = $1;
+    else
+        set DIRNAME = `dirname $SHIPENV`;
+        set BASENAME = "$DIRNAME/.."
+    endif
+
+    if ( $?PATH ) then
+        setenv PATH $BASENAME/bin:$PATH
+    else
+        setenv PATH $BASENAME/bin
+    endif
+
+    if ( $?PERL5LIB ) then
+        setenv PERL5LIB $BASENAME/lib/perl5/site_perl:$BASENAME/lib/perl5:$PERL5LIB
+    else
+        setenv PERL5LIB $BASENAME/lib/perl5/site_perl:$BASENAME/lib/perl5
+    endif
+
+    if ( $?LD_LIBRARY_PATH ) then
+        setenv LD_LIBRARY_PATH $BASENAME/lib:$LD_LIBRARY_PATH
+    else
+        setenv LD_LIBRARY_PATH $BASENAME/lib
+    endif
+    
+    if ( $?DYLD_LIBRARY_PATH ) then
+        setenv DYLD_LIBRARY_PATH $BASENAME/lib:$DYLD_LIBRARY_PATH
+    else
+        setenv DYLD_LIBRARY_PATH $BASENAME/lib
+    endif
 else
     echo 'USAGE: source shipwright-source-tcsh BASEPATH'
 endif



More information about the Bps-public-commit mailing list