* fix: default paths for list of class, and list of basic types

This commit is contained in:
Eray Özkural
2005-10-31 16:55:19 +00:00
parent d9ee5177d4
commit bbbb681fc9
2 changed files with 20 additions and 7 deletions
+11 -6
View File
@@ -35,14 +35,16 @@ class Error(pisi.Error):
__metaclass__ = xmlfile.autoxml __metaclass__ = xmlfile.autoxml
class Packager: class Packager:
t_Name = [xmlfile.Text, 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)
return s return s
class AdditionalFile: class AdditionalFile:
s_Filename = [xmlfile.String, xmlfile.mandatory] s_Filename = [xmlfile.String, xmlfile.mandatory]
a_Target = [xmlfile.String, xmlfile.mandatory] a_Target = [xmlfile.String, xmlfile.mandatory]
a_Permission = [xmlfile.String, xmlfile.optional] a_Permission = [xmlfile.String, xmlfile.optional]
@@ -55,6 +57,7 @@ class AdditionalFile:
class Patch: class Patch:
s_Filename = [xmlfile.String, xmlfile.mandatory] s_Filename = [xmlfile.String, xmlfile.mandatory]
a_compressionType = [xmlfile.String, xmlfile.optional] a_compressionType = [xmlfile.String, xmlfile.optional]
a_level = [xmlfile.String, xmlfile.optional] a_level = [xmlfile.String, xmlfile.optional]
@@ -70,9 +73,9 @@ class Patch:
s += ' target:' + self.target s += ' target:' + self.target
return s return s
class Update:
class Update:
a_release = [xmlfile.String, xmlfile.mandatory] a_release = [xmlfile.String, xmlfile.mandatory]
t_Date = [xmlfile.String, xmlfile.mandatory] t_Date = [xmlfile.String, xmlfile.mandatory]
t_Version = [xmlfile.String, xmlfile.mandatory] t_Version = [xmlfile.String, xmlfile.mandatory]
@@ -88,6 +91,7 @@ class Update:
class Path: class Path:
s_Path = [xmlfile.String, xmlfile.mandatory] s_Path = [xmlfile.String, xmlfile.mandatory]
a_fileType = [xmlfile.String, xmlfile.optional] a_fileType = [xmlfile.String, xmlfile.optional]
@@ -97,6 +101,7 @@ class Path:
return s return s
class Dependency: class Dependency:
s_Package = [xmlfile.String, xmlfile.mandatory] s_Package = [xmlfile.String, xmlfile.mandatory]
a_versionFrom = [xmlfile.String, xmlfile.optional] a_versionFrom = [xmlfile.String, xmlfile.optional]
a_versionTo = [xmlfile.String, xmlfile.optional] a_versionTo = [xmlfile.String, xmlfile.optional]
@@ -148,8 +153,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_Patches = [ [Patch], xmlfile.mandatory] t_Patches = [ [Patch], xmlfile.optional]
t_BuildDependencies = [ [Dependency], xmlfile.mandatory] t_BuildDependencies = [ [Dependency], xmlfile.optional]
class Package: class Package:
@@ -267,7 +272,7 @@ class SpecFile(XmlFile):
for update in self.history: for update in self.history:
err.join(update.has_errors()) err.join(update.has_errors())
return err.list return err.list
def write(self, filename): def write(self, filename):
"""Write PSPEC file""" """Write PSPEC file"""
self.newDOM() self.newDOM()
+9 -1
View File
@@ -432,8 +432,16 @@ 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 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: elif type(token_type) is autoxml:
path = token_type.tag + '/' + token # if a class, by default its tag
path = token_type.tag
else: else:
path = token # otherwise it's the same name as path = token # otherwise it's the same name as
# the token # the token