whitespace cleanup

This commit is contained in:
Faik Uygur
2009-07-16 09:00:10 +00:00
parent 9e2fd359ea
commit d2c398e8bb
+20 -20
View File
@@ -53,7 +53,7 @@ def safe_package_name(package):
def get_link(): def get_link():
"""Connect to the COMAR daemon and return the link.""" """Connect to the COMAR daemon and return the link."""
sockname = "/var/run/dbus/system_bus_socket" sockname = "/var/run/dbus/system_bus_socket"
# YALI starts comar chrooted in the install target, but uses PiSi outside of # YALI starts comar chrooted in the install target, but uses PiSi outside of
# the chroot environment, so PiSi needs to use a different socket path to be # the chroot environment, so PiSi needs to use a different socket path to be
@@ -61,14 +61,14 @@ def get_link():
# (usually /var/run/dbus/system_bus_socket) # (usually /var/run/dbus/system_bus_socket)
if ctx.dbus_sockname: if ctx.dbus_sockname:
sockname = ctx.dbus_sockname sockname = ctx.dbus_sockname
alternate = False alternate = False
# If COMAR package is updated, all new configuration requests should be # If COMAR package is updated, all new configuration requests should be
# made through new COMAR service. Passing alternate=True to Link() class # made through new COMAR service. Passing alternate=True to Link() class
# will ensure this. # will ensure this.
if ctx.comar_updated: if ctx.comar_updated:
alternate = True alternate = True
# This function is sometimes called when comar has recently started # This function is sometimes called when comar has recently started
# or restarting after an update. So we give comar a chance to become # or restarting after an update. So we give comar a chance to become
# active in a reasonable time. # active in a reasonable time.
@@ -89,19 +89,19 @@ def get_link():
def post_install(package_name, provided_scripts, scriptpath, metapath, filepath, fromVersion, fromRelease, toVersion, toRelease): def post_install(package_name, provided_scripts, scriptpath, metapath, filepath, fromVersion, fromRelease, toVersion, toRelease):
"""Do package's post install operations""" """Do package's post install operations"""
ctx.ui.info(_("Configuring %s package") % package_name) ctx.ui.info(_("Configuring %s package") % package_name)
self_post = False self_post = False
sys_service = False sys_service = False
package_name = safe_package_name(package_name) package_name = safe_package_name(package_name)
if package_name == 'comar': if package_name == 'comar':
ctx.ui.debug(_("COMAR package updated. From now on, using new COMAR daemon.")) ctx.ui.debug(_("COMAR package updated. From now on, using new COMAR daemon."))
pisi.api.set_comar_updated(True) pisi.api.set_comar_updated(True)
link = get_link() link = get_link()
for script in provided_scripts: for script in provided_scripts:
ctx.ui.debug(_("Registering %s comar script") % script.om) ctx.ui.debug(_("Registering %s comar script") % script.om)
if script.om == "System.Package": if script.om == "System.Package":
@@ -117,7 +117,7 @@ def post_install(package_name, provided_scripts, scriptpath, metapath, filepath,
link.System.Service[package_name].registerState() link.System.Service[package_name].registerState()
except dbus.DBusException, exception: except dbus.DBusException, exception:
raise Error, _("Script error: %s") % exception raise Error, _("Script error: %s") % exception
ctx.ui.debug(_("Calling post install handlers")) ctx.ui.debug(_("Calling post install handlers"))
for handler in link.System.PackageHandler: for handler in link.System.PackageHandler:
try: try:
@@ -126,13 +126,13 @@ def post_install(package_name, provided_scripts, scriptpath, metapath, filepath,
# Do nothing if setupPackage method is not defined in package script # Do nothing if setupPackage method is not defined in package script
if not is_method_missing(exception): if not is_method_missing(exception):
raise Error, _("Script error: %s") % exception raise Error, _("Script error: %s") % exception
if self_post: if self_post:
if not fromVersion: if not fromVersion:
fromVersion = "" fromVersion = ""
if not fromRelease: if not fromRelease:
fromRelease = "" fromRelease = ""
ctx.ui.debug(_("Running package's post install script")) ctx.ui.debug(_("Running package's post install script"))
try: try:
link.System.Package[package_name].postInstall(fromVersion, fromRelease, toVersion, toRelease, timeout=ctx.dbus_timeout) link.System.Package[package_name].postInstall(fromVersion, fromRelease, toVersion, toRelease, timeout=ctx.dbus_timeout)
@@ -143,12 +143,12 @@ def post_install(package_name, provided_scripts, scriptpath, metapath, filepath,
def pre_remove(package_name, metapath, filepath): def pre_remove(package_name, metapath, filepath):
"""Do package's pre removal operations""" """Do package's pre removal operations"""
ctx.ui.info(_("Running pre removal operations for %s") % package_name) ctx.ui.info(_("Running pre removal operations for %s") % package_name)
link = get_link() link = get_link()
package_name = safe_package_name(package_name) package_name = safe_package_name(package_name)
if package_name in list(link.System.Package): if package_name in list(link.System.Package):
ctx.ui.debug(_("Running package's pre remove script")) ctx.ui.debug(_("Running package's pre remove script"))
try: try:
@@ -157,7 +157,7 @@ def pre_remove(package_name, metapath, filepath):
# Do nothing if preRemove method is not defined in package script # Do nothing if preRemove method is not defined in package script
if not is_method_missing(exception): if not is_method_missing(exception):
raise Error, _("Script error: %s") % exception raise Error, _("Script error: %s") % exception
ctx.ui.debug(_("Calling pre remove handlers")) ctx.ui.debug(_("Calling pre remove handlers"))
for handler in list(link.System.PackageHandler): for handler in list(link.System.PackageHandler):
try: try:
@@ -169,12 +169,12 @@ def pre_remove(package_name, metapath, filepath):
def post_remove(package_name, metapath, filepath): def post_remove(package_name, metapath, filepath):
"""Do package's post removal operations""" """Do package's post removal operations"""
ctx.ui.info(_("Running post removal operations for %s") % package_name) ctx.ui.info(_("Running post removal operations for %s") % package_name)
link = get_link() link = get_link()
package_name = safe_package_name(package_name) package_name = safe_package_name(package_name)
if package_name in list(link.System.Package): if package_name in list(link.System.Package):
ctx.ui.debug(_("Running package's postremove script")) ctx.ui.debug(_("Running package's postremove script"))
try: try:
@@ -183,7 +183,7 @@ def post_remove(package_name, metapath, filepath):
# Do nothing if postRemove method is not defined in package script # Do nothing if postRemove method is not defined in package script
if not is_method_missing(exception): if not is_method_missing(exception):
raise Error, _("Script error: %s") % exception raise Error, _("Script error: %s") % exception
ctx.ui.debug(_("Calling post remove handlers")) ctx.ui.debug(_("Calling post remove handlers"))
for handler in list(link.System.PackageHandler): for handler in list(link.System.PackageHandler):
try: try:
@@ -192,7 +192,7 @@ def post_remove(package_name, metapath, filepath):
# Do nothing if postCleanupPackage method is not defined in package script # Do nothing if postCleanupPackage method is not defined in package script
if not is_method_missing(exception): if not is_method_missing(exception):
raise Error, _("Script error: %s") % exception raise Error, _("Script error: %s") % exception
ctx.ui.debug(_("Unregistering comar scripts")) ctx.ui.debug(_("Unregistering comar scripts"))
try: try:
link.remove(package_name, timeout=ctx.dbus_timeout) link.remove(package_name, timeout=ctx.dbus_timeout)