зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 0c2bc12f4ebe (bug 1384396) for breaking builds when hg username has non-ascii characters. r=backout a=backout on a CLOSED TREE
MozReview-Commit-ID: 2mqBxbDHsH0
This commit is contained in:
Родитель
72d39fa25b
Коммит
75704b249a
|
@ -404,11 +404,10 @@ always = dependable(True)
|
|||
never = dependable(False)
|
||||
|
||||
|
||||
# Create a decorator that will only execute the body of a function
|
||||
# if the passed function returns True when passed all positional
|
||||
# arguments.
|
||||
# Like @depends, but the decorated function is only called if one of the
|
||||
# arguments it would be called with has a positive value (bool(value) is True)
|
||||
@template
|
||||
def depends_tmpl(eval_args_fn, *args, **kwargs):
|
||||
def depends_if(*args, **kwargs):
|
||||
if kwargs:
|
||||
assert len(kwargs) == 1
|
||||
when = kwargs['when']
|
||||
|
@ -417,26 +416,11 @@ def depends_tmpl(eval_args_fn, *args, **kwargs):
|
|||
def decorator(func):
|
||||
@depends(*args, when=when)
|
||||
def wrapper(*args):
|
||||
if eval_args_fn(args):
|
||||
if any(arg for arg in args):
|
||||
return func(*args)
|
||||
return wrapper
|
||||
return decorator
|
||||
|
||||
|
||||
# Like @depends, but the decorated function is only called if one of the
|
||||
# arguments it would be called with has a positive value (bool(value) is True)
|
||||
@template
|
||||
def depends_if(*args, **kwargs):
|
||||
return depends_tmpl(any, *args, **kwargs)
|
||||
|
||||
|
||||
# Like @depends, but the decorated function is only called if all of the
|
||||
# arguments it would be called with have a positive value.
|
||||
@template
|
||||
def depends_all(*args, **kwargs):
|
||||
return depends_tmpl(all, *args, **kwargs)
|
||||
|
||||
|
||||
# Hacks related to old-configure
|
||||
# ==============================
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче