From bbbb681fc90bfaa430134e62b520e172fa497b35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Mon, 31 Oct 2005 16:55:19 +0000 Subject: [PATCH] * fix: default paths for list of class, and list of basic types --- pisi/specfilenew.py | 17 +++++++++++------ pisi/xmlfile.py | 10 +++++++++- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/pisi/specfilenew.py b/pisi/specfilenew.py index 0dac7d43..fbe4d5e8 100644 --- a/pisi/specfilenew.py +++ b/pisi/specfilenew.py @@ -35,14 +35,16 @@ class Error(pisi.Error): __metaclass__ = xmlfile.autoxml class Packager: + t_Name = [xmlfile.Text, xmlfile.mandatory] t_Email = [xmlfile.String, xmlfile.mandatory] def __str__(self): s = "%s <%s>" % (self.name, self.email) return s - + class AdditionalFile: + s_Filename = [xmlfile.String, xmlfile.mandatory] a_Target = [xmlfile.String, xmlfile.mandatory] a_Permission = [xmlfile.String, xmlfile.optional] @@ -55,6 +57,7 @@ class AdditionalFile: class Patch: + s_Filename = [xmlfile.String, xmlfile.mandatory] a_compressionType = [xmlfile.String, xmlfile.optional] a_level = [xmlfile.String, xmlfile.optional] @@ -70,9 +73,9 @@ class Patch: s += ' target:' + self.target return s - -class Update: +class Update: + a_release = [xmlfile.String, xmlfile.mandatory] t_Date = [xmlfile.String, xmlfile.mandatory] t_Version = [xmlfile.String, xmlfile.mandatory] @@ -88,6 +91,7 @@ class Update: class Path: + s_Path = [xmlfile.String, xmlfile.mandatory] a_fileType = [xmlfile.String, xmlfile.optional] @@ -97,6 +101,7 @@ class Path: return s class Dependency: + s_Package = [xmlfile.String, xmlfile.mandatory] a_versionFrom = [xmlfile.String, xmlfile.optional] a_versionTo = [xmlfile.String, xmlfile.optional] @@ -148,8 +153,8 @@ class Source: t_IsA = [ [xmlfile.String], xmlfile.mandatory] t_PartOf = [xmlfile.String, xmlfile.mandatory] t_Archive = [Archive, xmlfile.mandatory ] - t_Patches = [ [Patch], xmlfile.mandatory] - t_BuildDependencies = [ [Dependency], xmlfile.mandatory] + t_Patches = [ [Patch], xmlfile.optional] + t_BuildDependencies = [ [Dependency], xmlfile.optional] class Package: @@ -267,7 +272,7 @@ class SpecFile(XmlFile): for update in self.history: err.join(update.has_errors()) return err.list - + def write(self, filename): """Write PSPEC file""" self.newDOM() diff --git a/pisi/xmlfile.py b/pisi/xmlfile.py index 9e160009..a1cb599f 100644 --- a/pisi/xmlfile.py +++ b/pisi/xmlfile.py @@ -432,8 +432,16 @@ class autoxml(oo.autosuper): if len(spec)>=3: path = spec[2] # an alternative path specified + elif type(token_type) is type([]): + if type(token_type[0]) is autoxml: + # if list of class, by default nested like in most PSPEC + path = token + '/' + token_type[0].tag + else: + # if list of ordinary type, just take the name for + path = token elif type(token_type) is autoxml: - path = token_type.tag + '/' + token + # if a class, by default its tag + path = token_type.tag else: path = token # otherwise it's the same name as # the token