From b09b567b7cfe18e0e9bec4947b33d07e77d1b38f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Mon, 14 Nov 2005 10:09:30 +0000 Subject: [PATCH] * optional components in specfile --- pisi/component.py | 49 +++++++++++++++++++++++++---------------------- pisi/specfile.py | 3 +++ 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/pisi/component.py b/pisi/component.py index c558dee3..1eae335b 100644 --- a/pisi/component.py +++ b/pisi/component.py @@ -19,44 +19,47 @@ _ = __trans.ugettext import pisi import pisi.pxml.xmlfile as xmlfile +import pisi.pxml.autoxml as autoxml class Error(pisi.Error): pass -__metaclass__ = xmlfile.autoxml +__metaclass__ = autoxml.autoxml class Distribution: - t_Name = [xmlfile.Text, xmlfile.mandatory] - t_Description = [xmlfile.LocalText, xmlfile.mandatory] - t_Version = [xmlfile.Text, xmlfile.mandatory] - t_Type = [xmlfile.Text, xmlfile.mandatory] - t_Dependencies = [ [xmlfile.Text], xmlfile.optional, "Distribution"] + t_Name = [autoxml.Text, autoxml.mandatory] + t_Description = [autoxml.LocalText, autoxml.mandatory] + t_Version = [autoxml.Text, autoxml.mandatory] + t_Type = [autoxml.Text, autoxml.mandatory] + t_Dependencies = [ [autoxml.Text], autoxml.optional, "Dependencies/Distribution"] class Component(xmlfile.XmlFile): "part-of representation for component declarations" - __metaclass__ = xmlfile.autoxml + __metaclass__ = autoxml.autoxml tag = "PISI" - t_Name = [xmlfile.Text, xmlfile.mandatory] # fully qualified name - t_PartOf = [xmlfile.Text, xmlfile.mandatory] - t_LocalName = [xmlfile.LocalText, xmlfile.mandatory] - t_Description = [xmlfile.LocalText, xmlfile.mandatory] - #t_Icon = [xmlfile.Binary, xmlfile.mandatory] - t_Dependencies = [ [xmlfile.String], xmlfile.optional, "Dependencies/Component"] + t_Name = [autoxml.Text, autoxml.mandatory] # fully qualified name + t_PartOf = [autoxml.Text, autoxml.mandatory] + t_LocalName = [autoxml.LocalText, autoxml.mandatory] + t_Description = [autoxml.LocalText, autoxml.mandatory] + #t_Icon = [autoxml.Binary, autoxml.mandatory] + t_Dependencies = [ [autoxml.String], autoxml.optional, "Dependencies/Component"] -class ComponentTree(xmlfile.XmlFile): - "index representation for the component structure" +#FIXME: recursive declarations do not work! +#class ComponentTree(xmlfile.XmlFile): +# "index representation for the component structure" +# +# __metaclass__ = autoxml.autoxml +# +# tag = "Component" +# +# t_Name = [autoxml.Text, autoxml.mandatory] # fully qualified name +# #t_Icon = [autoxml.Binary, autoxml.mandatory] +# t_Dependencies = [ [autoxml.Text], autoxml.optional, "Component"] +# #t_Parts = [ [pisi.component.ComponentTree], autoxml.optional, "Component"] - __metaclass__ = xmlfile.autoxml - - tag = "Component" - - t_Name = [xmlfile.Text, xmlfile.mandatory] # fully qualified name - #t_Icon = [xmlfile.Binary, xmlfile.mandatory] - t_Dependencies = [ [xmlfile.Text], xmlfile.optional, "Component"] - t_Parts = [ [ComponentTree], xmlfile.optional, "Component"] diff --git a/pisi/specfile.py b/pisi/specfile.py index 4522f6a5..2089207f 100644 --- a/pisi/specfile.py +++ b/pisi/specfile.py @@ -31,9 +31,11 @@ import pisi.pxml.autoxml as autoxml import pisi.context as ctx from pisi.dependency import Dependency import pisi.dependency +import pisi.component as component from pisi.util import Checks import pisi.util as util + class Error(pisi.Error): pass @@ -205,6 +207,7 @@ class SpecFile(XmlFile): t_Source = [ Source, autoxml.mandatory] t_Packages = [ [Package], autoxml.mandatory, "Package"] t_History = [ [Update], autoxml.mandatory] + t_Components = [ [component.Component], autoxml.optional, "Component"] #we're not doing this with the init hook right now #def init(self, tag = "PISI"):