summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugin.xsd89
-rwxr-xr-xportato.py19
2 files changed, 1 insertions, 107 deletions
diff --git a/plugin.xsd b/plugin.xsd
deleted file mode 100644
index 38cb872..0000000
--- a/plugin.xsd
+++ /dev/null
@@ -1,89 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://portato.sourceforge.net/plugin" targetNamespace="http://portato.sourceforge.net/plugin" elementFormDefault="qualified">
- <xs:element name="plugin">
- <xs:complexType>
- <xs:all>
- <xs:element name="name" type="string" />
- <xs:element name="author" type="string" />
- <xs:element name="import" type="importString" minOccurs="0"/>
- <xs:element name="frontends" type="stringList" minOccurs="0" />
- <xs:element name="hooks" minOccurs="0">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="hook" minOccurs="1" maxOccurs="unbounded">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="connect" minOccurs="0" maxOccurs="unbounded">
- <xs:complexType>
- <xs:simpleContent>
- <xs:extension base="xs:string">
- <xs:attribute name="type" default="before">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:enumeration value="before" />
- <xs:enumeration value="override" />
- <xs:enumeration value="after" />
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- <xs:attribute name="type" type="string" use="required" />
- <xs:attribute name="call" type="functionCall" use="required" />
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="options" minOccurs="0">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="option" minOccurs="1" maxOccurs="unbounded" type="string" />
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="menu" minOccurs="0">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="item" minOccurs="1" maxOccurs="unbounded">
- <xs:complexType>
- <xs:simpleContent>
- <xs:extension base="string">
- <xs:attribute name="call" type="functionCall" use="required" />
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:all>
- </xs:complexType>
- </xs:element>
- <xs:simpleType name="importString">
- <xs:restriction base="xs:string">
- <xs:pattern value="([a-zA-Z_]+\.?)+" />
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="functionCall">
- <xs:restriction base="xs:string">
- <xs:pattern value="[a-zA-Z_][0-9a-zA-Z_]*" />
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="string">
- <xs:restriction base="xs:string">
- <xs:minLength value="1" />
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="_stringList">
- <xs:list itemType="string"/>
- </xs:simpleType>
- <xs:simpleType name="stringList">
- <xs:restriction base="_stringList">
- <xs:minLength value="1" />
- </xs:restriction>
- </xs:simpleType>
-</xs:schema>
diff --git a/portato.py b/portato.py
index a4f871a..69fb792 100755
--- a/portato.py
+++ b/portato.py
@@ -36,30 +36,13 @@ def main ():
parser.add_option("--shm", action = "store", nargs = 3, type="long", dest = "shm",
help = SUPPRESS_HELP)
- parser.add_option("-x", "--validate", action = "store", dest = "validate", metavar="PLUGIN",
- help = _("validates the given plugin xml instead of launching Portato"))
-
parser.add_option("-F", "--no-fork", "-L", action = "store_true", dest = "nofork", default = False,
help = _("do not fork off as root") + (" (%s)" % _("-L is deprecated")))
# run parser
(options, args) = parser.parse_args()
- if options.validate: # validate a plugin
- from lxml import etree
- try:
- etree.XMLSchema(file = XSD_LOCATION).assertValid(etree.parse(options.validate))
- except etree.XMLSyntaxError, e:
- print _("Validation failed. XML syntax error: %s.") % e[0]
- sys.exit(3)
- except etree.DocumentInvalid:
- print _("Validation failed. Does not comply with schema.")
- sys.exit(3)
- else:
- print _("Validation succeeded.")
- return
-
- elif options.nofork or os.getuid() == 0: # start GUI
+ if options.nofork or os.getuid() == 0: # start GUI
from portato.gui import run
from portato.helper import info
info("%s v. %s", _("Starting Portato"), VERSION)