Small updates to directives.
This commit is contained in:
parent
1f8ce403dc
commit
c105a8d42a
@ -240,14 +240,12 @@ def patch(pkg, url_or_filename, **kwargs):
|
||||
|
||||
|
||||
@directive(dicts='variants')
|
||||
def variant(pkg, name, description="", **kwargs):
|
||||
def variant(pkg, name, description=""):
|
||||
"""Define a variant for the package. Allows the user to supply
|
||||
+variant/-variant in a spec. You can optionally supply an
|
||||
initial + or - to make the variant enabled or disabled by defaut.
|
||||
"""
|
||||
return
|
||||
|
||||
if not re.match(r'[-~+]?[A-Za-z0-9_][A-Za-z0-9_.-]*', name):
|
||||
if not re.match(r'^[-~+]?[A-Za-z0-9_][A-Za-z0-9_.-]*$', name):
|
||||
raise DirectiveError("Invalid variant name in %s: '%s'"
|
||||
% (pkg.name, name))
|
||||
|
||||
|
@ -71,7 +71,7 @@ def check_invalid_constraint(self, spec, constraint):
|
||||
|
||||
|
||||
# ================================================================================
|
||||
# Satisfiability and constraints
|
||||
# Satisfiability
|
||||
# ================================================================================
|
||||
def test_satisfies(self):
|
||||
self.check_satisfies('libelf@0.8.13', '@0:1')
|
||||
@ -96,6 +96,9 @@ def test_satisfies_compiler_version(self):
|
||||
self.check_unsatisfiable('foo@4.0%pgi', '@1:3%pgi')
|
||||
self.check_unsatisfiable('foo@4.0%pgi@4.5', '@1:3%pgi@4.4:4.6')
|
||||
|
||||
self.check_satisfies('foo %gcc@4.7.3', '%gcc@4.7')
|
||||
self.check_unsatisfiable('foo %gcc@4.7', '%gcc@4.7.3')
|
||||
|
||||
|
||||
def test_satisfies_architecture(self):
|
||||
self.check_satisfies('foo=chaos_5_x86_64_ib', '=chaos_5_x86_64_ib')
|
||||
@ -147,7 +150,16 @@ def test_satisfies_virtual_dependency_versions(self):
|
||||
self.check_unsatisfiable('mpileaks^mpi@3:', '^mpich@1.0')
|
||||
|
||||
|
||||
def test_constrain(self):
|
||||
def test_satisfies_variant(self):
|
||||
self.check_satisfies('foo %gcc@4.7.3', '%gcc@4.7')
|
||||
self.check_unsatisfiable('foo %gcc@4.7', '%gcc@4.7.3')
|
||||
|
||||
|
||||
|
||||
# ================================================================================
|
||||
# Constraints
|
||||
# ================================================================================
|
||||
def test_constrain_variants(self):
|
||||
self.check_constrain('libelf@2.1:2.5', 'libelf@0:2.5', 'libelf@2.1:3')
|
||||
self.check_constrain('libelf@2.1:2.5%gcc@4.5:4.6',
|
||||
'libelf@0:2.5%gcc@2:4.6', 'libelf@2.1:3%gcc@4.5:4.7')
|
||||
@ -158,6 +170,8 @@ def test_constrain(self):
|
||||
self.check_constrain('libelf+debug~foo', 'libelf+debug', 'libelf~foo')
|
||||
self.check_constrain('libelf+debug~foo', 'libelf+debug', 'libelf+debug~foo')
|
||||
|
||||
|
||||
def test_constrain_arch(self):
|
||||
self.check_constrain('libelf=bgqos_0', 'libelf=bgqos_0', 'libelf=bgqos_0')
|
||||
self.check_constrain('libelf=bgqos_0', 'libelf', 'libelf=bgqos_0')
|
||||
|
||||
@ -170,8 +184,3 @@ def test_invalid_constraint(self):
|
||||
self.check_invalid_constraint('libelf+debug~foo', 'libelf+debug+foo')
|
||||
|
||||
self.check_invalid_constraint('libelf=bgqos_0', 'libelf=x86_54')
|
||||
|
||||
|
||||
def test_compiler_satisfies(self):
|
||||
self.check_satisfies('foo %gcc@4.7.3', '%gcc@4.7')
|
||||
self.check_unsatisfiable('foo %gcc@4.7', '%gcc@4.7.3')
|
||||
|
Loading…
Reference in New Issue
Block a user