Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions easybuild/framework/easyconfig/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@

# OTHER easyconfig parameters
'buildstats': [None, "A list of dicts with build statistics", OTHER],
'deprecated': [False, "Indicates whether or not this easyconfig file is deprecated "
"and will be archived in the next major release of EasyBuild", OTHER],
}


Expand Down
19 changes: 19 additions & 0 deletions easybuild/framework/easyconfig/easyconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
from easybuild.tools.toolchain.toolchain import TOOLCHAIN_CAPABILITIES, TOOLCHAIN_CAPABILITY_CUDA
from easybuild.tools.toolchain.utilities import get_toolchain, search_toolchain
from easybuild.tools.utilities import quote_py_str, remove_unwanted_chars
from easybuild.tools.version import VERSION
from easybuild.toolchains.compiler.cuda import Cuda

_log = fancylogger.getLogger('easyconfig.easyconfig', fname=False)
Expand Down Expand Up @@ -384,6 +385,9 @@ def __init__(self, path, extra_options=None, build_specs=None, validate=True, hi
self.build_specs = build_specs
self.parse()

# check whether this easyconfig file is deprecated, and act accordingly if so
self.check_deprecated(self.path)

# perform validations
self.validation = build_option('validate') and validate
if self.validation:
Expand Down Expand Up @@ -534,6 +538,21 @@ def parse(self):
# indicate that this is a parsed easyconfig
self._config['parsed'] = [True, "This is a parsed easyconfig", "HIDDEN"]

def check_deprecated(self, path):
"""Check whether this easyconfig file is deprecated."""

depr_msgs = []

if self['deprecated']:
depr_msgs.append("easyconfig file '%s' is marked as deprecated" % path)

if self.toolchain.is_deprecated():
depr_msgs.append("toolchain '%(name)s/%(version)s' is marked as deprecated" % self['toolchain'])

if depr_msgs:
depr_maj_ver = int(str(VERSION).split('.')[0]) + 1
self.log.deprecated(', '.join(depr_msgs), '%s.0' % depr_maj_ver)

def validate(self, check_osdeps=True):
"""
Validate this easyonfig
Expand Down
2 changes: 1 addition & 1 deletion easybuild/tools/build_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def deprecated(self, msg, ver, max_ver=None, *args, **kwargs):
def log_callback_warning_and_print(msg):
"""Log warning message, and also print it to stderr."""
self.warning(msg)
sys.stderr.write(msg + '\n')
sys.stderr.write('\nWARNING: ' + msg + '\n\n')

kwargs['log_callback'] = log_callback_warning_and_print

Expand Down
4 changes: 4 additions & 0 deletions easybuild/tools/toolchain/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,10 @@ def compilers(self):

return (c_comps, fortran_comps)

def is_deprecated(self):
"""Return whether or not this toolchain is deprecated."""
return False

def prepare(self, onlymod=None, silent=False, loadmod=True, rpath_filter_dirs=None, rpath_include_dirs=None):
"""
Prepare a set of environment parameters based on name/version of toolchain
Expand Down
10 changes: 5 additions & 5 deletions test/framework/build_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ def test_easybuildlog(self):
self.mock_stderr(False)

more_info = "see http://easybuild.readthedocs.org/en/latest/Deprecated-functionality.html for more information"
expected_stderr = '\n'.join([
"Deprecated functionality, will no longer work in v10000001: anotherwarning; " + more_info,
"Deprecated functionality, will no longer work in v2.0: onemorewarning",
"Deprecated functionality, will no longer work in v2.0: lastwarning",
]) + '\n'
expected_stderr = '\n\n'.join([
"\nWARNING: Deprecated functionality, will no longer work in v10000001: anotherwarning; " + more_info,
"\nWARNING: Deprecated functionality, will no longer work in v2.0: onemorewarning",
"\nWARNING: Deprecated functionality, will no longer work in v2.0: lastwarning",
]) + '\n\n'
self.assertEqual(stderr, expected_stderr)

try:
Expand Down
2 changes: 1 addition & 1 deletion test/framework/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -1343,7 +1343,7 @@ def test_deprecated(self):
except easybuild.tools.build_log.EasyBuildError, err:
self.assertTrue(False, 'Deprecated logging should work')

stderr_regex = re.compile("^Deprecated functionality, will no longer work in")
stderr_regex = re.compile("^\nWARNING: Deprecated functionality, will no longer work in")
self.assertTrue(stderr_regex.search(stderr), "Pattern '%s' found in: %s" % (stderr_regex.pattern, stderr))

# force it to current version, which should result in deprecation
Expand Down