diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-01-29 13:36:11 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-01-29 13:36:11 +0000 |
commit | b4feaa3416e58ffccc4b79d26e6df5256154d117 (patch) | |
tree | 907ed87b7ea37c78e01c68c66996d5757b754acf | |
parent | 3c29ef50d86257960104d6654a17e618fd1cd94a (diff) | |
download | portage-b4feaa3416e58ffccc4b79d26e6df5256154d117.tar.gz portage-b4feaa3416e58ffccc4b79d26e6df5256154d117.tar.bz2 portage-b4feaa3416e58ffccc4b79d26e6df5256154d117.zip |
Move the DOM unlink call to a finally block.
svn path=/main/trunk/; revision=15216
-rw-r--r-- | pym/repoman/utilities.py | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py index 5ce386737..8a2c0f0c6 100644 --- a/pym/repoman/utilities.py +++ b/pym/repoman/utilities.py @@ -124,28 +124,30 @@ def parse_metadata_use(mylines, uselist=None): raise exception.ParseError("metadata.xml: %s" % (e,)) try: - usetag = metadatadom.getElementsByTagName("use") - if not usetag: + + try: + usetag = metadatadom.getElementsByTagName("use") + if not usetag: + return uselist + except NotFoundErr: return uselist - except NotFoundErr: - return uselist - try: - flags = usetag[0].getElementsByTagName("flag") - except NotFoundErr: - raise exception.ParseError("metadata.xml: " + \ - "Malformed input: missing 'flag' tag(s)") - - for flag in flags: - pkg_flag = flag.getAttribute("name") - if not pkg_flag: + try: + flags = usetag[0].getElementsByTagName("flag") + except NotFoundErr: raise exception.ParseError("metadata.xml: " + \ - "Malformed input: missing 'name' attribute for 'flag' tag") - uselist.append(pkg_flag) - - metadatadom.unlink() - return uselist + "Malformed input: missing 'flag' tag(s)") + + for flag in flags: + pkg_flag = flag.getAttribute("name") + if not pkg_flag: + raise exception.ParseError("metadata.xml: " + \ + "Malformed input: missing 'name' attribute for 'flag' tag") + uselist.append(pkg_flag) + return uselist + finally: + metadatadom.unlink() def FindPackagesToScan(settings, startdir, reposplit): """ Try to find packages that need to be scanned |