From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (unknown [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 8B4E11381FA for ; Wed, 14 May 2014 00:37:11 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BF01CE0A8A; Wed, 14 May 2014 00:37:10 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 3CC0CE0A8A for ; Wed, 14 May 2014 00:37:10 +0000 (UTC) Received: from spoonbill.gentoo.org (unknown [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id F399D33F48B for ; Wed, 14 May 2014 00:37:08 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id 7BDEE180A9 for ; Wed, 14 May 2014 00:37:07 +0000 (UTC) From: "Devan Franchini" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Devan Franchini" Message-ID: <1400027707.9dff67cf63c78d7abb441de40b4d1e5c3ae7cb2d.twitch153@gentoo> Subject: [gentoo-commits] proj/layman:gsoc2014 commit in: layman/ X-VCS-Repository: proj/layman X-VCS-Files: layman/api.py layman/cli.py layman/dbbase.py layman/makeconf.py layman/remotedb.py layman/updater.py layman/utils.py X-VCS-Directories: layman/ X-VCS-Committer: twitch153 X-VCS-Committer-Name: Devan Franchini X-VCS-Revision: 9dff67cf63c78d7abb441de40b4d1e5c3ae7cb2d X-VCS-Branch: gsoc2014 Date: Wed, 14 May 2014 00:37:07 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 6925001a-17f6-4cb0-a57d-30a0f6ae49f8 X-Archives-Hash: 80a8451bd4021304e0c3d724c145ac2a commit: 9dff67cf63c78d7abb441de40b4d1e5c3ae7cb2d Author: Devan Franchini gentoo org> AuthorDate: Wed May 14 00:35:07 2014 +0000 Commit: Devan Franchini gentoo org> CommitDate: Wed May 14 00:35:07 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=9dff67cf Changes "Exception, error" to "Exception as error". This change has been made for py2 and py3 compatibility. --- layman/api.py | 16 ++++++++-------- layman/cli.py | 2 +- layman/dbbase.py | 4 ++-- layman/makeconf.py | 4 ++-- layman/remotedb.py | 10 +++++----- layman/updater.py | 2 +- layman/utils.py | 2 +- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/layman/api.py b/layman/api.py index 11534fd..475691b 100755 --- a/layman/api.py +++ b/layman/api.py @@ -113,7 +113,7 @@ class LaymanAPI(object): try: self._get_installed_db().delete( self._get_installed_db().select(ovl)) - except Exception, e: + except Exception as e: self._error( "Exception caught disabling repository '"+ovl+ "':\n"+str(e)) @@ -147,7 +147,7 @@ class LaymanAPI(object): try: success = self._get_installed_db().add( self._get_remote_db().select(ovl)) - except Exception, e: + except Exception as e: self._error("Exception caught enabling repository '"+ovl+ "' : "+str(e)) results.append(success) @@ -201,7 +201,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: @@ -255,7 +255,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) @@ -311,7 +311,7 @@ class LaymanAPI(object): #self.output.debug("API.sync(); selecting %s, db = %s" % (ovl, str(db)), 5) odb = db.select(ovl) self.output.debug("API.sync(); %s now selected" %ovl, 5) - except UnknownOverlayException, error: + except UnknownOverlayException as error: #self.output.debug("API.sync(); UnknownOverlayException selecting %s" %ovl, 5) #self._error(str(error)) fatals.append((ovl, @@ -364,7 +364,7 @@ class LaymanAPI(object): self.output.debug("API.sync(); starting db.sync(ovl)", 5) db.sync(ovl) 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))) @@ -457,7 +457,7 @@ class LaymanAPI(object): self.output.debug( 'LaymanAPI.fetch_remote_list(); cache updated = %s' % str(dbreload),8) - except Exception, error: + except Exception as error: self.output.error('Failed to fetch overlay list!\n Original Error was: ' + str(error)) return False @@ -585,7 +585,7 @@ class LaymanAPI(object): elif self.config['news_reporter'] == 'pkgcore': # pkgcore is not yet capable return - except Exception, err: + except Exception as err: msg = "update_news() failed running %s news reporter function\n" +\ "Error was; %s" self._error(msg % (self.config['news_reporter'], err)) diff --git a/layman/cli.py b/layman/cli.py index a5d2799..258e3b9 100644 --- a/layman/cli.py +++ b/layman/cli.py @@ -173,7 +173,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)) diff --git a/layman/dbbase.py b/layman/dbbase.py index e5c0fd9..8d57a9f 100644 --- a/layman/dbbase.py +++ b/layman/dbbase.py @@ -124,7 +124,7 @@ class DbBase(object): df = fileopen(path, 'r') document = df.read() - except Exception, error: + except Exception as error: if not self.ignore_init_read_errors: self.output.error('Failed to read the overlay list at ("' + path + '")') @@ -231,7 +231,7 @@ class DbBase(object): """) 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 9740072..1abe318 100644 --- a/layman/makeconf.py +++ b/layman/makeconf.py @@ -273,7 +273,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 @@ -290,7 +290,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/remotedb.py b/layman/remotedb.py index 98dffbb..38d9fa8 100644 --- a/layman/remotedb.py +++ b/layman/remotedb.py @@ -245,7 +245,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 directory ' + os.path.dirname(mpath) + '\n' + 'Error was:' + str(error)) @@ -290,7 +290,7 @@ class RemoteDB(DbBase): self.output.info('Remote list already up to date: %s' % url, 4) self.output.info('Last-modified: %s' % timestamp, 4) - except IOError, error: + except IOError as error: self.output.error('RemoteDB._fetch_file(); Failed to update the ' 'overlay list from: %s\nIOError was:%s\n' % (url, str(error))) @@ -333,7 +333,7 @@ class RemoteDB(DbBase): verify=verify, proxies=self.proxies, ) - except SSLError, error: + except SSLError as error: self.output.error('RemoteDB._fetch_url(); Failed to update the ' 'overlay list from: %s\nSSLError was:%s\n' % (url, str(error))) @@ -388,7 +388,7 @@ class RemoteDB(DbBase): try: self.read(olist, origin=url) - except Exception, error: + except Exception as error: self.output.debug("RemoteDB._check_download(), url=%s \nolist:\n" % url,2) self.output.debug(olist, 2) @@ -419,7 +419,7 @@ class RemoteDB(DbBase): has_updates = True - except Exception, error: + except Exception as error: raise IOError('Failed to temporarily cache overlays list in' ' ' + mpath + '\nError was:\n' + str(error)) return has_updates diff --git a/layman/updater.py b/layman/updater.py index f7d91e6..7c46707 100644 --- a/layman/updater.py +++ b/layman/updater.py @@ -23,7 +23,7 @@ def rename_db(config, newname, output): "name is...: %s" %newname, 2) output.notice('') return - except OSError, err: + except OSError as err: output.error(" Automatic db rename failed:\n%s" %str(err)) else: output.info(" Automatic db rename, failed access to: %s" diff --git a/layman/utils.py b/layman/utils.py index ab9904f..f174215 100644 --- a/layman/utils.py +++ b/layman/utils.py @@ -174,7 +174,7 @@ def delete_empty_directory(mdir, output=None): 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)