Example #1
0
 def __parse(v):
     if v.startswith('"') and v.endswith('"'):
         return v[1:-1]
     elif sep in v:
         return [P.parse(x) for x in U.parse_list_str(v)]
     else:
         return P.parse(v)
Example #2
0
    def test_02__default(self):
        relations_s = "obsoletes:mydata;conflicts:mydata-old"
        options, args = self.p.parse_args(["--relations", relations_s])

        expected = P.parse(relations_s)
        self.assertEquals(options.relations, expected)

        self.assertEquals(options.relations[0], ('obsoletes', ['mydata']))
        self.assertEquals(options.relations[1], ('conflicts', ['mydata-old']))
Example #3
0
    def load(self, config, forced_type=None):
        config = self._cparser.load(config, forced_type)

        # special cases:
        if "relations" in config:
            try:
                config.relations = P.parse(config.relations)
            except:
                print "config.relations=" + str(config.relations)
                raise

        if "template_paths" in config:
            config.template_paths = self.template_paths + \
                P.parse_list(config.template_paths)

        self.update(config)
Example #4
0
def parse_relations(relations):
    return P.parse(relations)