import M2Crypto
m2c_connection = M2Crypto.SSL.Connection.clientPostConnectionCheck
M2Crypto.SSL.Connection.clientPostConnectionCheck = None
- except ImportError, err:
+ except ImportError as err:
raise CreatorError("%s, please try to install python-m2crypto" % str(err))
proxy = None
f.write(conf)
f.close()
- os.chmod(confpath, 0644)
+ os.chmod(confpath, 0o644)
def _cleanupRpmdbLocks(self, installroot):
# cleans up temporary files left by bdb so that differing
return None
except yum.Errors.InstallError:
return "No package(s) available to install"
- except yum.Errors.RepoError, e:
+ except yum.Errors.RepoError as e:
raise CreatorError("Unable to download from repo : %s" % (e,))
- except yum.Errors.YumBaseError, e:
+ except yum.Errors.YumBaseError as e:
raise CreatorError("Unable to install: %s" % (e,))
def deselectPackage(self, pkg):
self.selectPackage(p)
return None
- except (yum.Errors.InstallError, yum.Errors.GroupsError), e:
+ except (yum.Errors.InstallError, yum.Errors.GroupsError) as e:
return e
- except yum.Errors.RepoError, e:
+ except yum.Errors.RepoError as e:
raise CreatorError("Unable to download from repo : %s" % (e,))
- except yum.Errors.YumBaseError, e:
+ except yum.Errors.YumBaseError as e:
raise CreatorError("Unable to install: %s" % (e,))
def addRepository(self, name, url = None, mirrorlist = None, proxy = None,
ts = rpmUtils.transaction.initReadOnlyTransaction()
try:
hdr = rpmUtils.miscutils.hdrFromPackage(ts, pkg)
- except rpmUtils.RpmUtilsError, e:
- raise yum.Errors.MiscError, \
- 'Could not open local rpm file: %s: %s' % (pkg, e)
+ except rpmUtils.RpmUtilsError as e:
+ raise yum.Errors.MiscError \
+ ('Could not open local rpm file: %s: %s' % (pkg, e))
self.deselectPackage(hdr['name'])
yum.YumBase.installLocal(self, pkg, po, updateonly)
os.environ["LD_PRELOAD"] = ""
try:
(res, resmsg) = self.buildTransaction()
- except yum.Errors.RepoError, e:
+ except yum.Errors.RepoError as e:
raise CreatorError("Unable to download from repo : %s" %(e,))
if res != 2:
raise CreatorError("No enough space used for downloading.")
# record the total size of installed pkgs
- pkgs_total_size = 0L
+ pkgs_total_size = 0
for x in dlpkgs:
if hasattr(x, 'installedsize'):
pkgs_total_size += int(x.installedsize)
raise CreatorError("mic failes to install some packages")
self._cleanupRpmdbLocks(self.conf.installroot)
- except rpmUtils.RpmUtilsError, e:
+ except rpmUtils.RpmUtilsError as e:
raise CreatorError("mic does NOT support delta rpm: %s" % e)
- except yum.Errors.RepoError, e:
+ except yum.Errors.RepoError as e:
raise CreatorError("Unable to download from repo : %s" % e)
- except yum.Errors.YumBaseError, e:
+ except yum.Errors.YumBaseError as e:
raise CreatorError("Unable to install: %s" % e)
finally:
msger.disable_logstderr()
}
try:
self.__pkgs_vcsinfo[lname] = hdr['VCS']
- except ValueError, KeyError:
+ except ValueError as KeyError:
self.__pkgs_vcsinfo[lname] = None
return self.__pkgs_vcsinfo