diff --git a/rakefile b/rakefile index 4644f30680..df0db9a56d 100644 --- a/rakefile +++ b/rakefile @@ -29,6 +29,11 @@ INSTALL_DIR_PATH = File.join(DEPLOY_DIR, NORMALIZED_DEPLOY_NAME) CLOBBER.include(BUILD_DIR, REPORT_DIR, 'cover*', '.coverage') CLEAN.include("#{BUILD_DIR}/*.deb", "#{BUILD_DIR}/util") +def select_executable(*cmds) + cmds.find_all{ |cmd| system("which #{cmd} > /dev/null 2>&1") }[0] || fail("No executables found from #{cmds.join(', ')}") +end + + task :default => [:pep8, :pylint, :test] directory REPORT_DIR @@ -47,7 +52,8 @@ end task :test => REPORT_DIR do ENV['NOSE_XUNIT_FILE'] = File.join(REPORT_DIR, "nosetests.xml") - sh("django-admin.py test --settings=envs.test --pythonpath=. $(ls djangoapps)") + django_admin = ENV['DJANGO_ADMIN_PATH'] || select_executable('django-admin.py', 'django-admin') + sh("#{django_admin} test --settings=envs.test --pythonpath=. $(ls djangoapps)") end task :package do