'with_or_without' accepts bool variants

Fixes #4112

This commit extends the support of the AutotoolsPackage methods
`with_or_without` and `enable_or_disable` to bool-valued variants. It
also defines for those functions a convenience short-cut if the
activation parameter is the prefix of a spec (like in
`--with-{pkg}={prefix}`).

This commit also includes:

* Updates to viennarna and adios accordingly: they have been modified to
  use `enable_or_disable` and `with_or_without`
* Improved docstrings in `autotools.py`. Raise `KeyError` if name is
  not a variant.
This commit is contained in:
Massimiliano Culpo
2017-09-12 01:20:49 +02:00
committed by scheibelp
parent f502de4725
commit 32117c22de
5 changed files with 203 additions and 110 deletions

View File

@@ -27,8 +27,9 @@
class Viennarna(AutotoolsPackage):
"""The ViennaRNA Package consists of a C code library and several
stand-alone programs for the prediction and comparison of RNA secondary
structures."""
stand-alone programs for the prediction and comparison of RNA secondary
structures.
"""
homepage = "https://www.tbi.univie.ac.at/RNA/"
url = "https://www.tbi.univie.ac.at/RNA/download/sourcecode/2_3_x/ViennaRNA-2.3.5.tar.gz"
@@ -49,19 +50,12 @@ def url_for_version(self, version):
return url.format(version.up_to(2).underscored, version)
def configure_args(self):
args = []
if '+sse' in self.spec:
args.append('--enable-sse')
else:
args.append('--disable-sse')
if '~python' in self.spec:
args.append('--without-python')
else:
args.append('--with-python')
if '~perl' in self.spec:
args.append('--without-perl')
else:
args.append('--with-perl')
args = self.enable_or_disable('sse')
args += self.with_or_without('python')
args += self.with_or_without('perl')
if 'python@3:' in self.spec:
args.append('--with-python3')
return args