public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Brian Dolbec" <brian.dolbec@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/layman:master commit in: layman/overlays/, layman/
Date: Wed, 27 Apr 2011 10:58:44 +0000 (UTC)	[thread overview]
Message-ID: <d0339cb228c16eb491d489a2276e254bacb41c81.dol-sen@gentoo> (raw)

commit:     d0339cb228c16eb491d489a2276e254bacb41c81
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sun Mar 27 03:39:37 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Mar 27 03:39:37 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=d0339cb2

migrate except ... as 

---
 layman/api.py              |   14 +++++++-------
 layman/cli.py              |    4 ++--
 layman/db.py               |    8 ++++----
 layman/dbbase.py           |    6 +++---
 layman/makeconf.py         |    4 ++--
 layman/overlays/overlay.py |    2 +-
 layman/overlays/tar.py     |   10 +++++-----
 layman/utils.py            |    2 +-
 8 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index 9dfb1a3..9178dbe 100644
--- a/layman/api.py
+++ b/layman/api.py
@@ -116,7 +116,7 @@ class LaymanAPI(object):
             try:
                 self._get_installed_db().delete(self._get_installed_db().select(ovl))
                 results.append(True)
-            except Exception, e:
+            except Exception as e:
                 self._error(ERROR_INTERNAL_ERROR,
                         "Failed to disable repository '"+ovl+"':\n"+str(e))
                 results.append(False)
@@ -147,7 +147,7 @@ class LaymanAPI(object):
             try:
                 self._get_installed_db().add(self._get_remote_db().select(ovl), quiet=True)
                 results.append(True)
-            except Exception, e:
+            except Exception as e:
                 self._error(ERROR_INTERNAL_ERROR,
                         "Failed to enable repository '"+ovl+"' : "+str(e))
                 results.append(False)
@@ -198,7 +198,7 @@ class LaymanAPI(object):
                 continue
             try:
                 overlay = db.select(ovl)
-            except UnknownOverlayException, error:
+            except UnknownOverlayException as error:
                 self._error(error)
                 result[ovl] = ('', False, False)
             else:
@@ -252,7 +252,7 @@ class LaymanAPI(object):
                 overlay = db.select(ovl)
                 #print("overlay = ", ovl)
                 #print("!!!", overlay)
-            except UnknownOverlayException, error:
+            except UnknownOverlayException as error:
                 #print("ERRORS", str(error))
                 self._error(error)
                 result[ovl] = ('', False, False)
@@ -301,7 +301,7 @@ class LaymanAPI(object):
         for ovl in repos:
             try:
                 odb = db.select(ovl)
-            except UnknownOverlayException, error:
+            except UnknownOverlayException as error:
                 self._error(UnknownOverlayException(error))
                 continue
 
@@ -344,7 +344,7 @@ class LaymanAPI(object):
             try:
                 db.sync(ovl, self.config['quiet'])
                 success.append((ovl,'Successfully synchronized overlay "' + ovl + '".'))
-            except Exception, error:
+            except Exception as error:
                 fatals.append((ovl,
                     'Failed to sync overlay "' + ovl + '".\nError was: '
                     + str(error)))
@@ -374,7 +374,7 @@ class LaymanAPI(object):
         """Fetches the latest remote overlay list"""
         try:
             self._get_remote_db().cache()
-        except Exception, error:
+        except Exception as error:
             self._error('Failed to fetch overlay list!\n Original Error was: '
                     + str(error))
             return False

diff --git a/layman/cli.py b/layman/cli.py
index 1187ef2..d58c4ff 100644
--- a/layman/cli.py
+++ b/layman/cli.py
@@ -162,7 +162,7 @@ class Main(object):
         try:
             new_umask = int(umask, 8)
             old_umask = os.umask(new_umask)
-        except Exception, error:
+        except Exception as error:
             self.output.die('Failed setting to umask "' + umask +
                 '"!\nError was: ' + str(error))
 
@@ -173,7 +173,7 @@ class Main(object):
             if action[0] in self.config.keys():
                 try:
                     result += getattr(self, action[1])()
-                except Exception, error:
+                except Exception as error:
                     for _error in self.api.get_errors():
                         self.output.error(_error)
                     result = -1  # So it cannot remain 0, i.e. success

diff --git a/layman/db.py b/layman/db.py
index ed2bb2e..6e3cba4 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -303,7 +303,7 @@ class RemoteDB(DbBase):
                 if not os.path.exists(os.path.dirname(mpath)):
                     try:
                         os.makedirs(os.path.dirname(mpath))
-                    except OSError, error:
+                    except OSError as error:
                         raise OSError('Failed to create layman storage direct'
                                       + 'ory ' + os.path.dirname(mpath) + '\n'
                                       + 'Error was:' + str(error))
@@ -312,7 +312,7 @@ class RemoteDB(DbBase):
                 # file is intact and can be parsed
                 try:
                     self.read(olist, origin=url)
-                except Exception, error:
+                except Exception as error:
                     raise IOError('Failed to parse the overlays list fetched fr'
                                   'om ' + url + '\nThis means that the download'
                                   'ed file is somehow corrupt or there was a pr'
@@ -325,12 +325,12 @@ class RemoteDB(DbBase):
                     out_file.write(olist)
                     out_file.close()
 
-                except Exception, error:
+                except Exception as error:
                     raise IOError('Failed to temporarily cache overlays list in'
                                   ' ' + mpath + '\nError was:\n' + str(error))
 
 
-            except IOError, error:
+            except IOError as error:
                 self.output.warn('Failed to update the overlay list from: '
                          + url + '\nError was:\n' + str(error))
 

diff --git a/layman/dbbase.py b/layman/dbbase.py
index 02aeb9d..5c45cb1 100644
--- a/layman/dbbase.py
+++ b/layman/dbbase.py
@@ -116,7 +116,7 @@ class DbBase:
         try:
             document = open(path, 'r').read()
 
-        except Exception, error:
+        except Exception as error:
             if not ignore_init_read_errors:
                 self.output.error('Failed to read the overlay list at ("'
                     + path + '")')
@@ -146,7 +146,7 @@ class DbBase:
         '''
         try:
             document = ET.fromstring(text)
-        except xml.parsers.expat.ExpatError, error:
+        except xml.parsers.expat.ExpatError as error:
             raise BrokenOverlayCatalog(origin, error, self._broken_catalog_hint())
 
         overlays = document.findall('overlay') + \
@@ -216,7 +216,7 @@ class DbBase:
 """)
             tree.write(f, encoding='utf-8')
             f.close()
-        except Exception, error:
+        except Exception as error:
             raise Exception('Failed to write to local overlays file: '
                             + path + '\nError was:\n' + str(error))
 

diff --git a/layman/makeconf.py b/layman/makeconf.py
index b6f5d90..1dd2b56 100644
--- a/layman/makeconf.py
+++ b/layman/makeconf.py
@@ -257,7 +257,7 @@ class MakeConf:
 
             make_conf.close()
 
-        except Exception, error:
+        except Exception as error:
             self.output.error('MakeConf: write(); Failed to write "'
                 + self.path + '".\nError was:\n' + str(error))
             return False
@@ -274,7 +274,7 @@ class MakeConf:
 
             make_conf.close()
 
-        except Exception, error:
+        except Exception as error:
             self.output.error('MakeConf: content(); Failed to read "' +
                 self.path + '".\nError was:\n' + str(error))
             raise error

diff --git a/layman/overlays/overlay.py b/layman/overlays/overlay.py
index aada4a2..b99c052 100644
--- a/layman/overlays/overlay.py
+++ b/layman/overlays/overlay.py
@@ -405,7 +405,7 @@ class Overlay(object):
                     # Worked, throw other sources away
                     self.sources = [s]
                     break
-            except Exception, error:
+            except Exception as error:
                 self.output.warn(str(error), 4)
             first_s = False
         return res

diff --git a/layman/overlays/tar.py b/layman/overlays/tar.py
index 9d59b71..204a626 100644
--- a/layman/overlays/tar.py
+++ b/layman/overlays/tar.py
@@ -107,7 +107,7 @@ class TarOverlay(OverlaySource):
 
         try:
             tar = urllib2.urlopen(tar_url).read()
-        except Exception, error:
+        except Exception as error:
             raise Exception('Failed to fetch the tar package from: '
                             + self.src + '\nError was:' + str(error))
 
@@ -117,7 +117,7 @@ class TarOverlay(OverlaySource):
             out_file = open(pkg, 'w')
             out_file.write(tar)
             out_file.close()
-        except Exception, error:
+        except Exception as error:
             raise Exception('Failed to store tar package in '
                             + pkg + '\nError was:' + str(error))
 
@@ -136,7 +136,7 @@ class TarOverlay(OverlaySource):
             try:
                 self.output.info('Deleting directory "%s"' % folder, 2)
                 shutil.rmtree(folder)
-            except Exception, error:
+            except Exception as error:
                 raise Exception('Failed to remove unnecessary tar structure "'
                                 + folder + '"\nError was:' + str(error))
 
@@ -145,7 +145,7 @@ class TarOverlay(OverlaySource):
         try:
             result = self._extract(base=base, tar_url=self.src,
                 dest_dir=temp_path)
-        except Exception, error:
+        except Exception as error:
             try_to_wipe(temp_path)
             raise error
 
@@ -161,7 +161,7 @@ class TarOverlay(OverlaySource):
 
                 try:
                     os.rename(source, final_path)
-                except Exception, error:
+                except Exception as error:
                     raise Exception('Failed to rename tar subdirectory ' +
                                     source + ' to ' + final_path +
                                     '\nError was:' + str(error))

diff --git a/layman/utils.py b/layman/utils.py
index 86524ef..03ddb45 100644
--- a/layman/utils.py
+++ b/layman/utils.py
@@ -167,7 +167,7 @@ def delete_empty_directory(mdir, output=OUT):
             output.info('Deleting _empty_ directory "%s"' % mdir, 2)
             try:
                 os.rmdir(mdir)
-            except OSError, error:
+            except OSError as error:
                 output.warn(str(error))
         else:
             output.warn('Insufficient permissions to delete _empty_ folder "%s".' % mdir)



             reply	other threads:[~2011-04-27 11:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-27 10:58 Brian Dolbec [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-04-24 20:59 [gentoo-commits] proj/layman:master commit in: layman/overlays/, layman/ Brian Dolbec
2014-06-16  3:40 Brian Dolbec
2014-06-16  3:40 Brian Dolbec
2014-06-16  3:37 [gentoo-commits] proj/layman:gsoc2014 " Brian Dolbec
2014-06-16  3:40 ` [gentoo-commits] proj/layman:master " Brian Dolbec
2011-09-24  6:07 Brian Dolbec
2011-08-24 14:02 Brian Dolbec
2011-08-21 16:42 Brian Dolbec
2011-08-11  3:24 Brian Dolbec
2011-08-07  2:29 Brian Dolbec
2011-08-06 18:29 Brian Dolbec
2011-07-30 16:53 Brian Dolbec
2011-07-29  6:11 Brian Dolbec
2011-04-27 10:58 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec
2011-02-14  6:00 Brian Dolbec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d0339cb228c16eb491d489a2276e254bacb41c81.dol-sen@gentoo \
    --to=brian.dolbec@gmail.com \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox