Exemplo n.º 1
0
 def _parse_requirements(self, node):
     reqs = []
     for child in node.children:
         req_text = child.get_text(child.NODE_FLAT)
         next_reqs = requirement_list.parse(req_text)
         reqs.extend(next_reqs)
     return requirement_list(reqs)
Exemplo n.º 2
0
 def __new__(clazz, filename, name, version, revision, epoch, system, level,
             arch, distro, distro_version, requirements, properties, files):
     check.check_string(filename)
     check.check_string(name)
     check.check_string(version)
     revision = int(revision)
     check.check_int(revision)
     epoch = int(epoch)
     check.check_int(epoch)
     check.check_string(system)
     check.check_string(level)
     arch = build_arch.check_arch(arch, system, distro)
     check.check_tuple(arch)
     check.check_string(distro)
     check.check_string(distro_version)
     if check.is_string(requirements):
         requirements = requirement_list.parse(requirements)
     requirements = requirements or requirement_list()
     check.check_requirement_list(requirements)
     properties = properties or {}
     check.check_dict(properties)
     check.check_package_files(files)
     return clazz.__bases__[0].__new__(clazz, 2, filename, name, version,
                                       revision, epoch, system, level, arch,
                                       distro, distro_version, requirements,
                                       properties, files)
Exemplo n.º 3
0
 def __init__(self, origin=None, values=None):
     super(value_requirement_list, self).__init__(origin)
     values = values or requirement_list()
     if not check.is_requirement_list(values):
         values = requirement_list.parse(values)
     check.check_requirement_list(values)
     self.values = values
Exemplo n.º 4
0
 def parse(clazz, origin, text, node):
     if origin:
         check.check_value_origin(origin)
     check.check_node(node)
     if not text:
         values = requirement_list()
     else:
         values = requirement_list.parse(text)
     return clazz(origin=origin, values=values)
Exemplo n.º 5
0
 def resolve(clazz, values, class_name):
     'Resolve a list of values if this type into a single requirement_list.'
     #    if class_name != value_type.STRING_LIST:
     #      values_string = [ str(x) for x in values ]
     #      print('WARNING: %s: class_name should be %s instead of %s for %s' % (values[0].origin, value_type.value_to_name(value_type.STRING_LIST),
     #                                                                         value_type.value_to_name(class_name), values_string))
     #      assert False
     #      return clazz.default_value(class_name)
     #      #raise TypeError('class_name should be %s instead of %d' % (value_type.STRING_LIST, class_name))
     result = requirement_list()
     for value in values:
         check.check_value_requirement_list(value)
         result.extend(value.values)
     result.remove_dups()
     return result
Exemplo n.º 6
0
 def requirements_from_string_list(clazz, l):
     check.check_string_seq(l)
     result = requirement_list()
     for n in l:
         result.extend(requirement_list.parse(n))
     return result
Exemplo n.º 7
0
 def _parse_requirements(clazz, l):
   check.check_string_seq(l)
   reqs = requirement_list()
   for n in l:
     reqs.extend(requirement_list.parse(n))
   return reqs
Exemplo n.º 8
0
 def default_value(clazz, class_name):
     return requirement_list()