From Diminutive Human, 1 Week ago, written in Plain Text.
  1. #!/bin/sh
  2. # Add psycpog2 path to python sys path
  3.  
  4. STRINGPATTERN_PY3=psycopg2-2.7.5-py3.5-linux-x86_64.egg
  5. STRINGPATTERN_PY2=psycopg2-2.7.5-py2.7-linux-x86_64.egg
  6.  
  7. # Match this pattern or return null string
  8. MATCH_PY3=$(cat /usr/lib/python3.5/site-packages/setuptools.pth | grep -o $STRINGPATTERN_PY3)  
  9. MATCH_PY2=$(cat /usr/lib/python2.7/site-packages/setuptools.pth | grep -o $STRINGPATTERN_PY2)
  10.  
  11. # if match is empty
  12. if [ -z "$MATCH_PY3" ]; then
  13.         echo "./psycopg2-2.7.5-py3.5-linux-x86_64.egg/" >> /usr/lib/python3.5/site-packages/setuptools.pth
  14. fi
  15.  
  16. if [ -z "$MATCH_PY2" ]; then
  17.         echo "./psycopg2-2.7.5-py2.7-linux-x86_64.egg/" >> /usr/lib/python2.7/site-packages/setuptools.pth
captcha