FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 12-10-2009, 03:12 PM
Hans de Goede
 
Default Get rid of the goofy nested try statements.

ack.

On 12/10/2009 04:52 PM, Chris Lumens wrote:

This only existed so we could put cleanup code around the whole loop to pop
a window, but that's probably the least clear way we could ever do such a
thing. Just be more explicit now.
---
yuminstall.py | 130 +++++++++++++++++++++++++++++---------------------------
1 files changed, 67 insertions(+), 63 deletions(-)

diff --git a/yuminstall.py b/yuminstall.py
index 4511c06..91dea9d 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -1376,77 +1376,81 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
else:
self.ayum.update()

- try:
- while True:
- try:
- (code, msgs) = self.ayum.buildTransaction()
-
- # If %packages --ignoremissing was given, don't bother
- # prompting for missing dependencies.
- if anaconda.isKickstart and anaconda.id.ksdata.packages.handleMissing == KS_MISSING_IGNORE:
- break
-
- if code == 1 and not anaconda.id.upgrade:
- # resolveDeps returns 0 if empty transaction, 1 if error,
- # 2 if success
- depprob = "
".join(msgs)
-
- rc = anaconda.intf.detailedMessageWindow(_("Warning"),
- _("Some of the packages you have selected for "
- "install are missing dependencies. You can "
- "exit the installation, go back and change "
- "your package selections, or continue "
- "installing these packages without their "
- "dependencies."),
- depprob + "
", type="custom", custom_icon="error",
- custom_buttons=[_("_Exit installer"), _("_Back"),
- _("_Continue")])
-
- if rc == 0:
- sys.exit(1)
- elif rc == 1:
- self.ayum._undoDepInstalls()
- return DISPATCH_BACK
+ while True:
+ try:
+ (code, msgs) = self.ayum.buildTransaction()

+ # If %packages --ignoremissing was given, don't bother
+ # prompting for missing dependencies.
+ if anaconda.isKickstart and anaconda.id.ksdata.packages.handleMissing == KS_MISSING_IGNORE:
break
- except RepoError, e:
- # FIXME: would be nice to be able to recover here
- rc = anaconda.intf.messageWindow(_("Error"),
- _("Unable to read package metadata. This may be "
- "due to a missing repodata directory. Please "
- "ensure that your install tree has been "
- "correctly generated.

%s" % e),
- type="custom", custom_icon="error",
- custom_buttons=[_("_Exit installer"), _("_Retry")])
+
+ if code == 1 and not anaconda.id.upgrade:
+ # resolveDeps returns 0 if empty transaction, 1 if error,
+ # 2 if success
+ depprob = "
".join(msgs)
+
+ rc = anaconda.intf.detailedMessageWindow(_("Warning"),
+ _("Some of the packages you have selected for "
+ "install are missing dependencies. You can "
+ "exit the installation, go back and change "
+ "your package selections, or continue "
+ "installing these packages without their "
+ "dependencies."),
+ depprob + "
", type="custom", custom_icon="error",
+ custom_buttons=[_("_Exit installer"), _("_Back"),
+ _("_Continue")])
+ dscb.pop()
+
if rc == 0:
- sys.exit(0)
- else:
- continue
+ sys.exit(1)
+ elif rc == 1:
+ self.ayum._undoDepInstalls()
+ return DISPATCH_BACK
+
+ break
+ except RepoError, e:
+ # FIXME: would be nice to be able to recover here
+ rc = anaconda.intf.messageWindow(_("Error"),
+ _("Unable to read package metadata. This may be "
+ "due to a missing repodata directory. Please "
+ "ensure that your install tree has been "
+ "correctly generated.

%s" % e),
+ type="custom", custom_icon="error",
+ custom_buttons=[_("_Exit installer"), _("_Retry")])
+ dscb.pop()
+
+ if rc == 0:
+ sys.exit(0)
else:
- break
+ continue
+ else:
+ break

- (self.dlpkgs, self.totalSize, self.totalFiles) = self.ayum.getDownloadPkgs()
+ (self.dlpkgs, self.totalSize, self.totalFiles) = self.ayum.getDownloadPkgs()

- if not anaconda.id.upgrade:
- largePart = anaconda.id.storage.mountpoints.get("/usr", anaconda.id.storage.rootDevice)
+ if not anaconda.id.upgrade:
+ largePart = anaconda.id.storage.mountpoints.get("/usr", anaconda.id.storage.rootDevice)

- if largePart and largePart.size< self.totalSize / 1024:
- rc = anaconda.intf.messageWindow(_("Error"),
- _("Your selected packages require %d MB "
- "of free space for installation, but "
- "you do not have enough available. "
- "You can change your selections or "
- "exit the installer." % (self.totalSize / 1024)),
- type="custom", custom_icon="error",
- custom_buttons=[_("_Back"), _("_Exit installer")])
+ if largePart and largePart.size< self.totalSize / 1024:
+ rc = anaconda.intf.messageWindow(_("Error"),
+ _("Your selected packages require %d MB "
+ "of free space for installation, but "
+ "you do not have enough available. "
+ "You can change your selections or "
+ "exit the installer." % (self.totalSize / 1024)),
+ type="custom", custom_icon="error",
+ custom_buttons=[_("_Back"), _("_Exit installer")])

- if rc == 1:
- sys.exit(1)
- else:
- self.ayum._undoDepInstalls()
- return DISPATCH_BACK
- finally:
- dscb.pop()
+ dscb.pop()
+
+ if rc == 1:
+ sys.exit(1)
+ else:
+ self.ayum._undoDepInstalls()
+ return DISPATCH_BACK
+
+ dscb.pop()

if anaconda.mediaDevice and not anaconda.isKickstart:
rc = presentRequiredMediaMessage(anaconda)


_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 05:12 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org