示例#1
0
def check_config_file(*args, **kwargs):

    value = args[-1][0]
    indent = ' ' * len('==> Error: ')
    if value == 'none':
        msg = 'the configuration flag is required and needs a configuration file ' \
              'as an argument [configuration=<FILE_NAME>]'
        raise error.SpecError(msg)
    else:
        result = fetchers.CNS_URL_Fetch_Strategy.check_configuration_file(
            value)
        if result != fetchers.CNS_URL_Fetch_Strategy.OK:
            raise error.SpecError(f'Error with configuration {value} {result}')
示例#2
0
文件: variant.py 项目: zeta1999/spack
        def _disjoint_set_validator(pkg_name, variant_name, values):
            # If for any of the sets, all the values are in it return True
            if any(all(x in s for x in values) for s in self.sets):
                return

            format_args = {
                'variant': variant_name, 'package': pkg_name, 'values': values
            }
            msg = self.error_fmt + \
                " @*r{{[{package}, variant '{variant}']}}"
            msg = llnl.util.tty.color.colorize(msg.format(**format_args))
            raise error.SpecError(msg)
示例#3
0
    def __init__(self, *sets):
        self.sets = [set(x) for x in sets]

        # 'none' is a special value and can appear only in a set of
        # a single element
        if any('none' in s and s != set(('none', )) for s in self.sets):
            raise error.SpecError("The value 'none' represents the empty set,"
                                  " and must appear alone in a set. Use the "
                                  "method 'allow_empty_set' to add it.")

        # Sets should not intersect with each other
        if any(s1 & s2 for s1, s2 in itertools.combinations(self.sets, 2)):
            raise error.SpecError('sets in input must be disjoint')

        #: Attribute used to track values which correspond to
        #: features which can be enabled or disabled as understood by the
        #: package's build system.
        self.feature_values = tuple(itertools.chain.from_iterable(self.sets))
        self.default = None
        self.multi = True
        self.error_fmt = "this variant accepts combinations of values from " \
                         "exactly one of the following sets '{values}' " \
                         "@*r{{[{package}, variant '{variant}']}}"