details: http://www.bx.psu.edu/hg/galaxy/rev/ec34b27de1c0 changeset: 3195:ec34b27de1c0 user: Nate Coraor <nate@bx.psu.edu> date: Mon Jan 04 12:51:34 2010 -0500 description: python run from virtualenv sets up site.py to pull things from the real python's lib directory, so 'python -S' breaks it. To fix this, have the check_python.py script check for virtualenv and output the arguments that should be used to start python ('python -E' for virtualenv, 'python -ES' for real), then use these arguments anywhere 'python -ES' was used in the past. diffstat: manage_db.sh | 2 +- run.sh | 8 +++++--- run_functional_tests.sh | 10 ++++++---- run_reports.sh | 2 +- run_unit_tests.sh | 2 +- scripts/check_python.py | 9 +++++++++ set_metadata.sh | 2 +- setup.sh | 4 ++-- 8 files changed, 26 insertions(+), 13 deletions(-) diffs (145 lines): diff -r 4743015d9a57 -r ec34b27de1c0 manage_db.sh --- a/manage_db.sh Wed Dec 23 20:26:01 2009 -0500 +++ b/manage_db.sh Mon Jan 04 12:51:34 2010 -0500 @@ -6,4 +6,4 @@ ####### cd `dirname $0` -python -ES ./scripts/manage_db.py $@ +`python ./scripts/check_python.py` ./scripts/manage_db.py $@ diff -r 4743015d9a57 -r ec34b27de1c0 run.sh --- a/run.sh Wed Dec 23 20:26:01 2009 -0500 +++ b/run.sh Mon Jan 04 12:51:34 2010 -0500 @@ -2,16 +2,18 @@ cd `dirname $0` +CLEAN_PYTHON=`python ./scripts/check_python.py` + # explicitly attempt to fetch eggs before running FETCH_EGGS=1 for arg in "$@"; do [ "$arg" = "--stop-daemon" ] && FETCH_EGGS=0; break done if [ $FETCH_EGGS -eq 1 ]; then - python -ES ./scripts/check_eggs.py quiet + $CLEAN_PYTHON ./scripts/check_eggs.py quiet if [ $? -ne 0 ]; then echo "Some eggs are out of date, attempting to fetch..." - python -ES ./scripts/fetch_eggs.py + $CLEAN_PYTHON ./scripts/fetch_eggs.py if [ $? -eq 0 ]; then echo "Fetch successful." else @@ -20,4 +22,4 @@ fi fi fi -python -ES ./scripts/paster.py serve universe_wsgi.ini $@ +$CLEAN_PYTHON ./scripts/paster.py serve universe_wsgi.ini $@ diff -r 4743015d9a57 -r ec34b27de1c0 run_functional_tests.sh --- a/run_functional_tests.sh Wed Dec 23 20:26:01 2009 -0500 +++ b/run_functional_tests.sh Mon Jan 04 12:51:34 2010 -0500 @@ -4,8 +4,10 @@ rm -f run_functional_tests.log +CLEAN_PYTHON=`python ./scripts/check_python.py` + if [ ! $1 ]; then - python -ES ./scripts/functional_tests.py -v --with-nosehtml --html-report-file run_functional_tests.html --exclude="^get" functional + $CLEAN_PYTHON ./scripts/functional_tests.py -v --with-nosehtml --html-report-file run_functional_tests.html --exclude="^get" functional elif [ $1 = 'help' ]; then echo "'run_functional_tests.sh' for testing all the tools in functional directory" echo "'run_functional_tests.sh aaa' for testing one test case of 'aaa' ('aaa' is the file name with path)" @@ -13,16 +15,16 @@ echo "'run_functional_tests.sh -sid ccc' for testing one section with sid 'ccc' ('ccc' is the string after 'section::')" echo "'run_functional_tests.sh -list' for listing all the tool ids" elif [ $1 = '-id' ]; then - python -ES ./scripts/functional_tests.py -v functional.test_toolbox:TestForTool_$2 --with-nosehtml --html-report-file run_functional_tests.html + $CLEAN_PYTHON ./scripts/functional_tests.py -v functional.test_toolbox:TestForTool_$2 --with-nosehtml --html-report-file run_functional_tests.html elif [ $1 = '-sid' ]; then - python -ES ./scripts/functional_tests.py --with-nosehtml --html-report-file run_functional_tests.html -v `python tool_list.py $2` + $CLEAN_PYTHON ./scripts/functional_tests.py --with-nosehtml --html-report-file run_functional_tests.html -v `python tool_list.py $2` elif [ $1 = '-list' ]; then python tool_list.py echo "===========================================================================================================================================" echo "'run_functional_tests.sh -id bbb' for testing one tool with id 'bbb' ('bbb' is the tool id)" echo "'run_functional_tests.sh -sid ccc' for testing one section with sid 'ccc' ('ccc' is the string after 'section::')" else - python -ES ./scripts/functional_tests.py -v --with-nosehtml --html-report-file run_functional_tests.html $1 + $CLEAN_PYTHON ./scripts/functional_tests.py -v --with-nosehtml --html-report-file run_functional_tests.html $1 fi echo "'run_functional_tests.sh help' for help" diff -r 4743015d9a57 -r ec34b27de1c0 run_reports.sh --- a/run_reports.sh Wed Dec 23 20:26:01 2009 -0500 +++ b/run_reports.sh Mon Jan 04 12:51:34 2010 -0500 @@ -2,4 +2,4 @@ cd `dirname $0` -python -ES ./scripts/paster.py serve reports_wsgi.ini --pid-file=reports_webapp.pid --log-file=reports_webapp.log $@ +`python ./scripts/check_python.py` ./scripts/paster.py serve reports_wsgi.ini --pid-file=reports_webapp.pid --log-file=reports_webapp.log $@ diff -r 4743015d9a57 -r ec34b27de1c0 run_unit_tests.sh --- a/run_unit_tests.sh Wed Dec 23 20:26:01 2009 -0500 +++ b/run_unit_tests.sh Mon Jan 04 12:51:34 2010 -0500 @@ -2,6 +2,6 @@ ## Excluding controllers due to the problematic genetrack dependency -python -ES ./scripts/nosetests.py -v -w lib \ +`python ./scripts/check_python.py` ./scripts/nosetests.py -v -w lib \ --with-nosehtml --html-report-file run_unit_tests.html \ --with-doctest --exclude=functional --exclude="^get" --exclude=controllers diff -r 4743015d9a57 -r ec34b27de1c0 scripts/check_python.py --- a/scripts/check_python.py Wed Dec 23 20:26:01 2009 -0500 +++ b/scripts/check_python.py Mon Jan 04 12:51:34 2010 -0500 @@ -6,6 +6,13 @@ supported version is installed but is not your default, getgalaxy.org contains instructions on how to force Galaxy to use a different version.""" % sys.version[:3] +def check_virtualenv(): + try: + assert sys.real_prefix + return 'python -E' + except: + return 'python -ES' + def check_python(): try: assert sys.version_info[:2] >= ( 2, 4 ) and sys.version_info[:2] <= ( 2, 6 ) @@ -16,5 +23,7 @@ if __name__ == '__main__': try: check_python() + print check_virtualenv() + sys.exit( 0 ) except: sys.exit( 1 ) diff -r 4743015d9a57 -r ec34b27de1c0 set_metadata.sh --- a/set_metadata.sh Wed Dec 23 20:26:01 2009 -0500 +++ b/set_metadata.sh Mon Jan 04 12:51:34 2010 -0500 @@ -1,4 +1,4 @@ #!/bin/sh cd `dirname $0` -python -ES ./scripts/set_metadata.py $@ +`python ./scripts/check_python.py` ./scripts/set_metadata.py $@ diff -r 4743015d9a57 -r ec34b27de1c0 setup.sh --- a/setup.sh Wed Dec 23 20:26:01 2009 -0500 +++ b/setup.sh Mon Jan 04 12:51:34 2010 -0500 @@ -1,6 +1,6 @@ #!/bin/sh -python ./scripts/check_python.py +CLEAN_PYTHON=`python ./scripts/check_python.py` [ $? -ne 0 ] && exit 1 SAMPLES=" @@ -56,4 +56,4 @@ fi done -python ./scripts/fetch_eggs.py +$CLEAN_PYTHON ./scripts/fetch_eggs.py