SpecFile init esnasında self kontrolleri uyguluyor, her türlü
hata XmlError exception raise ediyor.
This commit is contained in:
@@ -18,14 +18,14 @@ from pisi.ui import ui
|
||||
def handle_exception(exception, value, tb):
|
||||
import traceback
|
||||
import exceptions
|
||||
import xml
|
||||
import pisi.xmlext.XmlError as XmlError
|
||||
from pisi.ui import ui
|
||||
|
||||
if exception == exceptions.KeyboardInterrupt:
|
||||
ui.error("\nKeyboardInterrupt: Exiting...\n")
|
||||
sys.exit(1)
|
||||
elif exception == xml.parsers.expat.ExpatError:
|
||||
ui.error("Invalid XML: " + str(value)+'\n')
|
||||
elif exception == XmlError:
|
||||
ui.error(str(value))
|
||||
sys.exit(1)
|
||||
|
||||
ui.error("""
|
||||
|
||||
@@ -87,13 +87,6 @@ class PisiBuild:
|
||||
self.actionGlobals = None
|
||||
self.srcDir = None
|
||||
|
||||
errs = self.spec.has_errors()
|
||||
if errs:
|
||||
ui.error("PSPEC file is not valid\n")
|
||||
for e in errs:
|
||||
ui.error(e + '\n')
|
||||
raise PisiBuildError, "invalid PSPEC file %s" % self.ctx.pspecfile
|
||||
|
||||
def set_state(self, state):
|
||||
stateFile = os.path.join(self.srcDir, "pisiBuildState")
|
||||
open(stateFile, "w").write(state)
|
||||
|
||||
@@ -27,6 +27,7 @@ from ui import ui
|
||||
from dependency import DepInfo
|
||||
from util import Checks
|
||||
|
||||
|
||||
class PackagerInfo:
|
||||
def __init__(self, node = None):
|
||||
if node:
|
||||
@@ -376,6 +377,13 @@ class SpecFile(XmlFile):
|
||||
|
||||
self.unlink()
|
||||
|
||||
errs = self.has_errors()
|
||||
if errs:
|
||||
e = ""
|
||||
for x in errs:
|
||||
e += x + "\n"
|
||||
raise XmlError("File '%s' has errors:\n%s" % (filename, e))
|
||||
|
||||
def override_tags(self):
|
||||
"""Override tags from Source in Packages. Some tags in Packages
|
||||
overrides the tags from Source. There is a more detailed
|
||||
|
||||
+5
-1
@@ -23,6 +23,7 @@
|
||||
# Baris Metin <baris@uludag.org.tr
|
||||
|
||||
import xml.dom.minidom as mdom
|
||||
import xml.parsers.expat.ExpatError as ExpatError
|
||||
import codecs
|
||||
|
||||
from xmlext import *
|
||||
@@ -45,7 +46,10 @@ class XmlFile(object):
|
||||
self.dom.unlink()
|
||||
|
||||
def readxml(self, fileName):
|
||||
self.dom = mdom.parse(fileName)
|
||||
try:
|
||||
self.dom = mdom.parse(fileName)
|
||||
except ExpatError, inst:
|
||||
raise XmlError("File '%s' has invalid XML: %s" % (fileName, str(inst)))
|
||||
|
||||
def writexml(self, fileName):
|
||||
f = codecs.open(fileName,'w', "utf-8")
|
||||
|
||||
Reference in New Issue
Block a user