1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-02-04 10:36:17 +01:00

use more generic oscerr.PackageNotInstalled

This commit is contained in:
Ludwig Nussel 2011-03-29 17:15:35 +02:00
parent b0ddeb909d
commit b33577b6a7
3 changed files with 13 additions and 9 deletions

View File

@ -158,7 +158,7 @@ def run(prg):
print >>sys.stderr, e.msg
return 1
except oscerr.ServiceNotInstalled, e:
except oscerr.PackageNotInstalled, e:
print >>sys.stderr, e.msg
return 1
@ -207,4 +207,8 @@ def run(prg):
print >>sys.stderr, e
return 1
except oscerr.OscBaseError, e:
print >>sys.stderr, '*** Error:', e
return 1
# vim: sw=4 et

View File

@ -328,9 +328,7 @@ class Serviceinfo:
temp_dir = tempfile.mkdtemp()
name = call.split(None, 1)[0]
if not os.path.exists("/usr/lib/obs/service/"+name):
msg = "ERROR: service is not installed!\n"
msg += "Maybe try this: zypper in obs-service-" + name
raise oscerr.ServiceNotInstalled(msg)
raise oscerr.PackageNotInstalled("obs-service-"+name)
c = "/usr/lib/obs/service/" + call + " --outdir " + temp_dir
if conf.config['verbose'] > 1:
print "Run source service:", c

View File

@ -101,13 +101,15 @@ class OscIOError(OscBaseError):
self.e = e
self.msg = msg
class ServiceNotInstalled(OscBaseError):
class PackageNotInstalled(OscBaseError):
"""
Exception raised when a service is not installed on local system
Exception raised when a package is not installed on local system
"""
def __init__(self, msg):
OscBaseError.__init__(self)
self.msg = msg
def __init__(self, pkg):
OscBaseError.__init__(self, pkg)
def __str__(self):
return 'Package %s is required for this operation' % ''.join(self.args)
class SignalInterrupt(Exception):
"""Exception raised on SIGTERM and SIGHUP."""