Skip to content

Commit 4e71a0b

Browse files
Merge pull request #1 from boegel/bash_completion
sync with develop
2 parents e2249e8 + 411431c commit 4e71a0b

File tree

9 files changed

+72
-114
lines changed

9 files changed

+72
-114
lines changed

easybuild/toolchains/compiler/craype.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class CrayPECompiler(Compiler):
5959
COMPILER_FAMILY = None
6060

6161
COMPILER_UNIQUE_OPTS = {
62-
'dynamic': (False, "Generate dynamically linked executable"),
62+
'dynamic': (True, "Generate dynamically linked executable"),
6363
'mpich-mt': (False, "Directs the driver to link in an alternate version of the Cray-MPICH library which \
6464
provides fine-grained multi-threading support to applications that perform \
6565
MPI operations within threaded regions."),

easybuild/toolchains/craycce.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,12 @@
2929
@author: Kenneth Hoste (Ghent University)
3030
"""
3131
from easybuild.toolchains.compiler.craype import CrayPECray
32-
from easybuild.toolchains.fft.crayfftw import CrayFFTW
3332
from easybuild.toolchains.linalg.libsci import LibSci
3433
from easybuild.toolchains.mpi.craympich import CrayMPICH
3534
from easybuild.tools.toolchain import DUMMY_TOOLCHAIN_NAME
3635

3736

38-
class CrayCCE(CrayPECray, CrayMPICH, LibSci, CrayFFTW):
37+
class CrayCCE(CrayPECray, CrayMPICH, LibSci):
3938
"""Compiler toolchain for Cray Programming Environment for Cray Compiling Environment (CCE) (PrgEnv-cray)."""
4039
NAME = 'CrayCCE'
4140
SUBTOOLCHAIN = DUMMY_TOOLCHAIN_NAME

easybuild/toolchains/craygnu.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,12 @@
2929
@author: Kenneth Hoste (Ghent University)
3030
"""
3131
from easybuild.toolchains.compiler.craype import CrayPEGCC
32-
from easybuild.toolchains.fft.crayfftw import CrayFFTW
3332
from easybuild.toolchains.linalg.libsci import LibSci
3433
from easybuild.toolchains.mpi.craympich import CrayMPICH
3534
from easybuild.tools.toolchain import DUMMY_TOOLCHAIN_NAME
3635

3736

38-
class CrayGNU(CrayPEGCC, CrayMPICH, LibSci, CrayFFTW):
37+
class CrayGNU(CrayPEGCC, CrayMPICH, LibSci):
3938
"""Compiler toolchain for Cray Programming Environment for GCC compilers (PrgEnv-gnu)."""
4039
NAME = 'CrayGNU'
4140
SUBTOOLCHAIN = DUMMY_TOOLCHAIN_NAME

easybuild/toolchains/crayintel.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,12 @@
2929
@author: Kenneth Hoste (Ghent University)
3030
"""
3131
from easybuild.toolchains.compiler.craype import CrayPEIntel
32-
from easybuild.toolchains.fft.crayfftw import CrayFFTW
3332
from easybuild.toolchains.linalg.libsci import LibSci
3433
from easybuild.toolchains.mpi.craympich import CrayMPICH
3534
from easybuild.tools.toolchain import DUMMY_TOOLCHAIN_NAME
3635

3736

38-
class CrayIntel(CrayPEIntel, CrayMPICH, LibSci, CrayFFTW):
37+
class CrayIntel(CrayPEIntel, CrayMPICH, LibSci):
3938
"""Compiler toolchain for Cray Programming Environment for Intel compilers (PrgEnv-intel)."""
4039
NAME = 'CrayIntel'
4140
SUBTOOLCHAIN = DUMMY_TOOLCHAIN_NAME

easybuild/toolchains/fft/crayfftw.py

Lines changed: 0 additions & 71 deletions
This file was deleted.

easybuild/tools/filetools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ def search_file(paths, query, short=False, ignore_dirs=None, silent=False, filen
373373

374374
if terse:
375375
for line in hits:
376-
print line
376+
print(line)
377377
else:
378378
for line in var_lines + hit_lines:
379379
print_msg(line, log=_log, silent=silent, prefix=False)

easybuild/tools/options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ def postprocess(self):
569569
if not HAVE_AUTOPEP8:
570570
raise EasyBuildError("Python 'autopep8' module required to reformat dumped easyconfigs as requested")
571571

572-
# some options imply enabling --terse
572+
# imply --terse for --last-log to avoid extra output that gets in the way
573573
if self.options.last_log:
574574
self.options.terse = True
575575

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def find_rel_test():
9191
packages=easybuild_packages,
9292
package_dir={'test.framework': "test/framework"},
9393
package_data={"test.framework": find_rel_test()},
94-
scripts=["eb", "optcomplete.bash", "minimal_bash_completion.bash"],
94+
scripts=["eb", "optcomplete.bash", "minimal_bash_completion.bash", "eb_bash_completion.bash"],
9595
data_files=[('easybuild/scripts', glob.glob('easybuild/scripts/*'))],
9696
long_description=read('README.rst'),
9797
classifiers=[

test/framework/options.py

Lines changed: 65 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -559,65 +559,97 @@ def test_list_easyblocks(self):
559559
def test_search(self):
560560
"""Test searching for easyconfigs."""
561561

562-
fd, dummylogfn = tempfile.mkstemp(prefix='easybuild-dummy', suffix='.log')
563-
os.close(fd)
562+
test_easyconfigs_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'easyconfigs')
564563

564+
# simple search
565565
args = [
566566
'--search=gzip',
567-
'--robot=%s' % os.path.join(os.path.dirname(__file__), 'easyconfigs'),
568-
'--unittest-file=%s' % self.logfile,
567+
'--robot=%s' % test_easyconfigs_dir,
569568
]
570-
self.eb_main(args, logfile=dummylogfn)
571-
logtxt = read_file(self.logfile)
569+
self.mock_stdout(True)
570+
self.eb_main(args, testing=False)
571+
txt = self.get_stdout()
572+
self.mock_stdout(False)
572573

573574
info_msg = r"Searching \(case-insensitive\) for 'gzip' in"
574-
self.assertTrue(re.search(info_msg, logtxt), "Info message when searching for easyconfigs in '%s'" % logtxt)
575+
self.assertTrue(re.search(info_msg, txt), "Info message when searching for easyconfigs in '%s'" % txt)
575576
for ec in ["gzip-1.4.eb", "gzip-1.4-GCC-4.6.3.eb"]:
576-
self.assertTrue(re.search(r" \* \S*%s$" % ec, logtxt, re.M), "Found easyconfig %s in '%s'" % (ec, logtxt))
577-
578-
if os.path.exists(dummylogfn):
579-
os.remove(dummylogfn)
580-
581-
write_file(self.logfile, '')
577+
regex = re.compile(r" \* \S*%s$" % ec, re.M)
578+
self.assertTrue(regex.search(txt), "Found pattern '%s' in: %s" % (regex.pattern, txt))
582579

580+
# search w/ regex
583581
args = [
584582
'--search=^gcc.*2.eb',
585-
'--robot=%s' % os.path.join(os.path.dirname(__file__), 'easyconfigs'),
586-
'--unittest-file=%s' % self.logfile,
583+
'--robot=%s' % test_easyconfigs_dir,
587584
]
588-
self.eb_main(args, logfile=dummylogfn)
589-
logtxt = read_file(self.logfile)
585+
self.mock_stdout(True)
586+
self.eb_main(args, testing=False)
587+
txt = self.get_stdout()
588+
self.mock_stdout(False)
590589

591590
info_msg = r"Searching \(case-insensitive\) for '\^gcc.\*2.eb' in"
592-
self.assertTrue(re.search(info_msg, logtxt), "Info message when searching for easyconfigs in '%s'" % logtxt)
591+
self.assertTrue(re.search(info_msg, txt), "Info message when searching for easyconfigs in '%s'" % txt)
593592
for ec in ['GCC-4.7.2.eb', 'GCC-4.8.2.eb', 'GCC-4.9.2.eb']:
594-
self.assertTrue(re.search(r" \* \S*%s$" % ec, logtxt, re.M), "Found easyconfig %s in '%s'" % (ec, logtxt))
593+
regex = re.compile(r" \* \S*%s$" % ec, re.M)
594+
self.assertTrue(regex.search(txt), "Found pattern '%s' in: %s" % (regex.pattern, txt))
595595

596-
if os.path.exists(dummylogfn):
597-
os.remove(dummylogfn)
596+
gcc_ecs = [
597+
'GCC-4.6.3.eb',
598+
'GCC-4.6.4.eb',
599+
'GCC-4.7.2.eb',
600+
'GCC-4.8.2.eb',
601+
'GCC-4.8.3.eb',
602+
'GCC-4.9.2.eb',
603+
]
598604

599-
write_file(self.logfile, '')
605+
# test --search-filename
606+
args = [
607+
'--search-filename=^gcc',
608+
'--robot=%s' % test_easyconfigs_dir,
609+
]
610+
self.mock_stdout(True)
611+
self.eb_main(args, testing=False)
612+
txt = self.get_stdout()
613+
self.mock_stdout(False)
614+
615+
for ec in gcc_ecs:
616+
regex = re.compile(r"^ \* %s$" % ec, re.M)
617+
self.assertTrue(regex.search(txt), "Found pattern '%s' in: %s" % (regex.pattern, txt))
600618

619+
# test --search-filename --terse
620+
args = [
621+
'--search-filename=^gcc',
622+
'--terse',
623+
'--robot=%s' % test_easyconfigs_dir,
624+
]
625+
self.mock_stdout(True)
626+
self.eb_main(args, testing=False)
627+
txt = self.get_stdout()
628+
self.mock_stdout(False)
629+
630+
for ec in gcc_ecs:
631+
regex = re.compile(r"^%s$" % ec, re.M)
632+
self.assertTrue(regex.search(txt), "Found pattern '%s' in: %s" % (regex.pattern, txt))
633+
634+
# also test --search-short/-S
601635
for search_arg in ['-S', '--search-short']:
602-
open(self.logfile, 'w').write('')
603636
args = [
604637
search_arg,
605638
'toy-0.0',
606639
'-r',
607-
os.path.join(os.path.dirname(__file__), 'easyconfigs'),
608-
'--unittest-file=%s' % self.logfile,
640+
test_easyconfigs_dir,
609641
]
610-
self.eb_main(args, logfile=dummylogfn, raise_error=True, verbose=True)
611-
logtxt = read_file(self.logfile)
642+
self.mock_stdout(True)
643+
self.eb_main(args, raise_error=True, verbose=True, testing=False)
644+
txt = self.get_stdout()
645+
self.mock_stdout(False)
612646

613647
info_msg = r"Searching \(case-insensitive\) for 'toy-0.0' in"
614-
self.assertTrue(re.search(info_msg, logtxt), "Info message when searching for easyconfigs in '%s'" % logtxt)
615-
self.assertTrue(re.search('INFO CFGS\d+=', logtxt), "CFGS line message found in '%s'" % logtxt)
648+
self.assertTrue(re.search(info_msg, txt), "Info message when searching for easyconfigs in '%s'" % txt)
649+
self.assertTrue(re.search('^CFGS\d+=', txt, re.M), "CFGS line message found in '%s'" % txt)
616650
for ec in ["toy-0.0.eb", "toy-0.0-multiple.eb"]:
617-
self.assertTrue(re.search(" \* \$CFGS\d+/*%s" % ec, logtxt), "Found easyconfig %s in '%s'" % (ec, logtxt))
618-
619-
if os.path.exists(dummylogfn):
620-
os.remove(dummylogfn)
651+
regex = re.compile(r" \* \$CFGS\d+/*%s" % ec, re.M)
652+
self.assertTrue(regex.search(txt), "Found pattern '%s' in: %s" % (regex.pattern, txt))
621653

622654
def test_dry_run(self):
623655
"""Test dry run (long format)."""

0 commit comments

Comments
 (0)