* 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 :)
This commit is contained in:
Eray Özkural
2005-10-26 22:34:02 +00:00
parent cb6d7fef3e
commit 081a980268
2 changed files with 14 additions and 11 deletions
+11 -10
View File
@@ -35,7 +35,7 @@ class Error(pisi.Error):
__metaclass__ = xmlfile.autoxml __metaclass__ = xmlfile.autoxml
class Packager: class Packager:
t_Name = [xmlfile.String, xmlfile.mandatory] t_Name = [xmlfile.Text, xmlfile.mandatory]
t_Email = [xmlfile.String, xmlfile.mandatory] t_Email = [xmlfile.String, xmlfile.mandatory]
def __str__(self): def __str__(self):
s = "%s <%s>" % (self.name, self.email) s = "%s <%s>" % (self.name, self.email)
@@ -140,7 +140,7 @@ class Archive:
class Source: class Source:
t_Name = [xmlfile.String, xmlfile.mandatory] t_Name = [xmlfile.String, xmlfile.mandatory]
t_HomePage = [xmlfile.String, xmlfile.mandatory] t_Homepage = [xmlfile.String, xmlfile.mandatory]
t_Packager = [Packager, xmlfile.mandatory] t_Packager = [Packager, xmlfile.mandatory]
t_Summary = [xmlfile.String, xmlfile.mandatory] t_Summary = [xmlfile.String, xmlfile.mandatory]
t_Description = [xmlfile.String, xmlfile.mandatory] t_Description = [xmlfile.String, xmlfile.mandatory]
@@ -148,8 +148,8 @@ class Source:
t_IsA = [ [xmlfile.String], xmlfile.mandatory] t_IsA = [ [xmlfile.String], xmlfile.mandatory]
t_PartOf = [xmlfile.String, xmlfile.mandatory] t_PartOf = [xmlfile.String, xmlfile.mandatory]
t_Archive = [Archive, xmlfile.mandatory ] t_Archive = [Archive, xmlfile.mandatory ]
t_Patch = [ [Patch], xmlfile.mandatory, "Patch"] t_Patches = [ [Patch], xmlfile.mandatory]
t_BuildDep = [ [Dependency], xmlfile.mandatory, "Dependency"] t_BuildDependencies = [ [Dependency], xmlfile.mandatory]
class Package: class Package:
@@ -157,12 +157,12 @@ class Package:
t_Name = [ xmlfile.String, xmlfile.mandatory ] t_Name = [ xmlfile.String, xmlfile.mandatory ]
t_Summary = [ xmlfile.String, xmlfile.mandatory ] t_Summary = [ xmlfile.String, xmlfile.mandatory ]
t_Description = [ xmlfile.String, xmlfile.mandatory ] t_Description = [ xmlfile.String, xmlfile.mandatory ]
t_IsA = [ [xmlfile.String], xmlfile.mandatory] t_PartOf = [xmlfile.String, xmlfile.optional]
t_PartOf = [xmlfile.String, xmlfile.mandatory] t_IsA = [ [xmlfile.String], xmlfile.optional]
t_Conflicts = [ [xmlfile.String], xmlfile.mandatory, "Package"] t_Conflicts = [ [xmlfile.String], xmlfile.optional, "Conflicts/Package"]
t_ProvidesComar = [ [ComarProvide], xmlfile.mandatory, "COMAR"] t_ProvidesComar = [ [ComarProvide], xmlfile.optional, "Provides/COMAR"]
#t_RequriesComar = [ [xmlfile.String], xmlfile.mandatory, "Requires/COMAR"] #t_RequriesComar = [ [xmlfile.String], xmlfile.mandatory, "Requires/COMAR"]
t_AdditionalFiles = [ [AdditionalFile], xmlfile.mandatory, "AdditionalFile"] t_AdditionalFiles = [ [AdditionalFile], xmlfile.optional]
class SpecFile(XmlFile): class SpecFile(XmlFile):
@@ -172,8 +172,9 @@ class SpecFile(XmlFile):
t_Source = [ Source, xmlfile.mandatory] t_Source = [ Source, xmlfile.mandatory]
t_Packages = [ [Package], xmlfile.mandatory, "Package"] 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"): #def init(self, tag = "PISI"):
#ignore tag #ignore tag
#XmlFile.__init__(self, tag) #XmlFile.__init__(self, tag)
+3 -1
View File
@@ -397,6 +397,8 @@ class autoxml(oo.autosuper):
if len(spec)>=3: if len(spec)>=3:
path = spec[2] # an alternative path specified path = spec[2] # an alternative path specified
elif type(token_type) is autoxml:
path = token_type.tag + '/' + token
else: else:
path = token # otherwise it's the same name as path = token # otherwise it's the same name as
# the token # the token
@@ -422,7 +424,7 @@ class autoxml(oo.autosuper):
if text: if text:
try: try:
value = autoxml.basic_cons_map[token_type](text) value = autoxml.basic_cons_map[token_type](text)
except Error: except:
value = None value = None
errs.append(where + _('Type mismatch: read text cannot be decoded')) errs.append(where + _('Type mismatch: read text cannot be decoded'))
return value return value