diff --git a/.gitignore b/.gitignore index c6bb2c7fdd..4b67ea8dfa 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ .project LICENSE_HEADER *.pyc +*.pyo *.nja build/ dist/ diff --git a/easybuild/tools/build_log.py b/easybuild/tools/build_log.py index c170f4d185..856160ec9b 100644 --- a/easybuild/tools/build_log.py +++ b/easybuild/tools/build_log.py @@ -64,6 +64,8 @@ class EasyBuildError(LoggedException): """ LOC_INFO_TOP_PKG_NAMES = ['easybuild', 'vsc'] LOC_INFO_LEVEL = 1 + # always include location where error was raised from, even under 'python -O' + INCLUDE_LOCATION = True # use custom error logging method, to make sure EasyBuildError isn't being raised again to avoid infinite recursion # only required because 'error' log method raises (should no longer be needed in EB v3.x) diff --git a/easybuild/tools/testing.py b/easybuild/tools/testing.py index 96463e1b6d..40e6a0881c 100644 --- a/easybuild/tools/testing.py +++ b/easybuild/tools/testing.py @@ -35,12 +35,10 @@ """ import copy import os -import re import sys from datetime import datetime from time import gmtime, strftime -import easybuild.tools.config as config from easybuild.framework.easyblock import build_easyconfigs from easybuild.framework.easyconfig.tools import process_easyconfig from easybuild.framework.easyconfig.tools import skip_available diff --git a/eb b/eb index 04cecac50d..46a7aaa784 100755 --- a/eb +++ b/eb @@ -74,4 +74,11 @@ then exit 3 fi +# enable optimization, unless $PYTHONOPTIMIZE is defined (use "export PYTHONOPTIMIZE=0" to disable optimization) +if [ -z $PYTHONOPTIMIZE ] +then + # instruct Python to turn on basic optimizations (equivalent to using 'python -O') + export PYTHONOPTIMIZE=1 +fi + $PYTHON -m easybuild.main "$@" diff --git a/setup.cfg b/setup.cfg index 65eff4cc9e..7b4bba08d3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,7 @@ +[install] +# generate .pyo files, 'eb' uses 'python -O' or sets $PYTHONOPTIMIZE +optimize=1 + [bdist_rpm] requires = environment-modules, bash, python >= 2.6, python < 3 diff --git a/setup.py b/setup.py index 8abb0ac5d0..ebfbb70fed 100644 --- a/setup.py +++ b/setup.py @@ -107,7 +107,7 @@ def find_rel_test(): provides=["eb"] + easybuild_packages, test_suite="test.framework.suite", zip_safe=False, - install_requires=["vsc-base >= 2.2.4"], + install_requires=["vsc-base >= 2.2.6"], extras_require = { 'yeb': ["PyYAML >= 3.11"], }, diff --git a/test/framework/utilities.py b/test/framework/utilities.py index 757d805d93..35309f7861 100644 --- a/test/framework/utilities.py +++ b/test/framework/utilities.py @@ -84,6 +84,10 @@ def setUp(self): """Set up testcase.""" super(EnhancedTestCase, self).setUp() + # make sure option parser doesn't pick up any cmdline arguments/options + while len(sys.argv) > 1: + sys.argv.pop() + # keep track of log handlers log = fancylogger.getLogger(fname=False) self.orig_log_handlers = log.handlers[:]