Skip to content

Instantly share code, notes, and snippets.

@nzjrs
Last active December 21, 2015 07:08
Show Gist options
  • Save nzjrs/6268729 to your computer and use it in GitHub Desktop.
Save nzjrs/6268729 to your computer and use it in GitHub Desktop.
Lame virtualenv / jhbuild clone
#get the current directory. from
#http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in
pushd . > /dev/null
DIR="${BASH_SOURCE[0]}";
if ([ -h "${DIR}" ]) then
while([ -h "${DIR}" ]) do cd `dirname "$DIR"`; DIR=`readlink "${DIR}"`; done
fi
cd `dirname ${DIR}` > /dev/null
DIR=`pwd`;
popd > /dev/null
echo $DIR
export CMAKE_PREFIX_PATH=$DIR/
export PATH=$DIR/bin/:$PATH
export LD_LIBRARY_PATH=$DIR/lib/:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=$DIR/lib/pkgconfig/:$PKG_CONFIG_PATH
export PYTHONPATH=$DIR/lib/python2.7/dist-packages/:$DIR/lib/python2.7/site-packages/:$PYTHONPATH
export GST_PLUGIN_SYSTEM_PATH=$DIR/lib/gstreamer-0.10:$GST_PLUGIN_SYSTEM_PATH
export GI_TYPELIB_PATH=$DIR/lib/girepository-1.0/:$GI_TYPELIB_PATH
export PYTHONDONTWRITEBYTECODE=1
PS1="[`basename $DIR`] $PS1"
export PS1
@randomstuff
Copy link

@matze
Copy link

matze commented Jul 22, 2014

Interesting (and I should've subscribed to your blog earlier …).

I use a slightly different approach that forks a new shell to update the environment variables. It also allows adding arbitrary environment variables by sourcing a specific file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment