From 081a9802686c026f596c0a1aebe4fd3610f62932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Wed, 26 Oct 2005 22:34:02 +0000 Subject: [PATCH] * autoxml: smart setting of default path for list types! * fix several errors in specfilenew! too many to list here! * we're really in business now :) --- pisi/specfilenew.py | 21 +++++++++++---------- pisi/xmlfile.py | 4 +++- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/pisi/specfilenew.py b/pisi/specfilenew.py index 7ad08a12..89b5e06b 100644 --- a/pisi/specfilenew.py +++ b/pisi/specfilenew.py @@ -35,7 +35,7 @@ class Error(pisi.Error): __metaclass__ = xmlfile.autoxml class Packager: - t_Name = [xmlfile.String, xmlfile.mandatory] + t_Name = [xmlfile.Text, xmlfile.mandatory] t_Email = [xmlfile.String, xmlfile.mandatory] def __str__(self): s = "%s <%s>" % (self.name, self.email) @@ -140,7 +140,7 @@ class Archive: class Source: t_Name = [xmlfile.String, xmlfile.mandatory] - t_HomePage = [xmlfile.String, xmlfile.mandatory] + t_Homepage = [xmlfile.String, xmlfile.mandatory] t_Packager = [Packager, xmlfile.mandatory] t_Summary = [xmlfile.String, xmlfile.mandatory] t_Description = [xmlfile.String, xmlfile.mandatory] @@ -148,8 +148,8 @@ class Source: t_IsA = [ [xmlfile.String], xmlfile.mandatory] t_PartOf = [xmlfile.String, xmlfile.mandatory] t_Archive = [Archive, xmlfile.mandatory ] - t_Patch = [ [Patch], xmlfile.mandatory, "Patch"] - t_BuildDep = [ [Dependency], xmlfile.mandatory, "Dependency"] + t_Patches = [ [Patch], xmlfile.mandatory] + t_BuildDependencies = [ [Dependency], xmlfile.mandatory] class Package: @@ -157,12 +157,12 @@ class Package: t_Name = [ xmlfile.String, xmlfile.mandatory ] t_Summary = [ xmlfile.String, xmlfile.mandatory ] t_Description = [ xmlfile.String, xmlfile.mandatory ] - t_IsA = [ [xmlfile.String], xmlfile.mandatory] - t_PartOf = [xmlfile.String, xmlfile.mandatory] - t_Conflicts = [ [xmlfile.String], xmlfile.mandatory, "Package"] - t_ProvidesComar = [ [ComarProvide], xmlfile.mandatory, "COMAR"] + t_PartOf = [xmlfile.String, xmlfile.optional] + t_IsA = [ [xmlfile.String], xmlfile.optional] + t_Conflicts = [ [xmlfile.String], xmlfile.optional, "Conflicts/Package"] + t_ProvidesComar = [ [ComarProvide], xmlfile.optional, "Provides/COMAR"] #t_RequriesComar = [ [xmlfile.String], xmlfile.mandatory, "Requires/COMAR"] - t_AdditionalFiles = [ [AdditionalFile], xmlfile.mandatory, "AdditionalFile"] + t_AdditionalFiles = [ [AdditionalFile], xmlfile.optional] class SpecFile(XmlFile): @@ -172,8 +172,9 @@ class SpecFile(XmlFile): t_Source = [ Source, xmlfile.mandatory] t_Packages = [ [Package], xmlfile.mandatory, "Package"] - t_History = [ [Update], xmlfile.mandatory, "Update"] + t_History = [ [Update], xmlfile.mandatory, "History/Update"] + #we're not doing this with the init hook right now #def init(self, tag = "PISI"): #ignore tag #XmlFile.__init__(self, tag) diff --git a/pisi/xmlfile.py b/pisi/xmlfile.py index d9da5360..7b0958e7 100644 --- a/pisi/xmlfile.py +++ b/pisi/xmlfile.py @@ -397,6 +397,8 @@ class autoxml(oo.autosuper): if len(spec)>=3: path = spec[2] # an alternative path specified + elif type(token_type) is autoxml: + path = token_type.tag + '/' + token else: path = token # otherwise it's the same name as # the token @@ -422,7 +424,7 @@ class autoxml(oo.autosuper): if text: try: value = autoxml.basic_cons_map[token_type](text) - except Error: + except: value = None errs.append(where + _('Type mismatch: read text cannot be decoded')) return value