-
-
Save paltman/27653 to your computer and use it in GitHub Desktop.
added a check for empty SITE_PACKAGES variable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# If there is not already a SITE_PACKAGES environment variable, then get it | |
# from Python. | |
if [[ -z $SITE_PACKAGES || ! -d $SITE_PACKAGES ]] | |
then | |
SITE_PACKAGES=`python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"` | |
fi | |
# Parse the first argument | |
BASE=`basename $1` | |
DIR=`dirname $1` | |
# Go into the directory of the first argument | |
pushd $DIR | |
if [ $2 ]; then | |
# If an additional name for the module has been provided, use that as the | |
# link's basename. | |
ln -sfnv `pwd`/$BASE $SITE_PACKAGES/`basename $2` | |
else | |
# Otherwise, use the basename of the given location. | |
ln -sfnv `pwd`/$BASE $SITE_PACKAGES/$BASE | |
fi | |
# Return to where we were before | |
popd > /dev/null | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment