* [gentoo-portage-dev] [PATCH] emirrordist: support bsddb3 module (bug 570798)
@ 2016-01-05 16:09 Zac Medico
2016-01-07 11:47 ` Alexander Berntsen
0 siblings, 1 reply; 2+ messages in thread
From: Zac Medico @ 2016-01-05 16:09 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Zac Medico
If shelve.open raises ImportError for bsddb, then use bsddb3 instead.
X-Gentoo-Bug: 570798
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=570798
---
pym/portage/_emirrordist/Config.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/pym/portage/_emirrordist/Config.py b/pym/portage/_emirrordist/Config.py
index f884a49..574a835 100644
--- a/pym/portage/_emirrordist/Config.py
+++ b/pym/portage/_emirrordist/Config.py
@@ -109,7 +109,15 @@ class Config(object):
if self.options.dry_run and not os.path.exists(db_file):
db = {}
else:
- db = shelve.open(db_file, flag=open_flag)
+ try:
+ db = shelve.open(db_file, flag=open_flag)
+ except ImportError as e:
+ # ImportError has different attributes for python2 vs. python3
+ if (getattr(e, 'name', None) == 'bsddb' or
+ getattr(e, 'message', None) == 'No module named bsddb'):
+ from bsddb3 import dbshelve
+ db = dbshelve.open(db_file, flags=open_flag)
+
if sys.hexversion < 0x3000000:
db = ShelveUnicodeWrapper(db)
--
2.4.10
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] emirrordist: support bsddb3 module (bug 570798)
2016-01-05 16:09 [gentoo-portage-dev] [PATCH] emirrordist: support bsddb3 module (bug 570798) Zac Medico
@ 2016-01-07 11:47 ` Alexander Berntsen
0 siblings, 0 replies; 2+ messages in thread
From: Alexander Berntsen @ 2016-01-07 11:47 UTC (permalink / raw
To: gentoo-portage-dev
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
LGTM.
- --
Alexander
bernalex@gentoo.org
https://secure.plaimi.net/~alexander
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBCgAGBQJWjlBUAAoJENQqWdRUGk8Bw2YP/2chKr38vVFCAUmKn5pN24cA
AifZiDVU2jHgjJNU1pZHDwv3C7LfQBaakwMeECM30xArAzkPchPM57l0w3cxDrnV
GR3zMwoF8lxH8nrky1MQzdaWFTryx8e5r+j4S0oBR246PUsBnRXExUqgfypiFbXb
DcGtTFF9sWZEWZVRg+TLi3J7xMvbwH9PBx7YhfASSzXPFl0QQ/JdQOeP6iefcuzv
yFbmiNEgE2VPJFsW8bwm+LCxGgKWXgz3nLEs03PqqwgggLQg0GWrAAYktX5IeiJD
B75ZF9HAtVqfaF1t9iiN9spG8rc2DDIyaX2fDm8KsGnlDow7GLpKYfYSF7XXt6Ve
Xw2GvOZYQbJD0UY/z8CFq1TU6kXVJrUXpPhbbibKsu3X3uMaWW7bzOChZxjiECOT
M2oSxS0kn+FvAblCZ8allnIvJZe4NXwMLQ2myRDAoPC3jI+VwNtymH5FohMGg60m
mFmMnSEHNToxDG4J9soYVS9BvEtOdZey4j6y5+ePWwz/jqZie8LPezXhiflNt2Qw
o4jMHWNDDgLPJ9FdtNpg9ZyDtIZ0SFzDT+OsoX5can9CqU/de78D40eIkYOUSOLW
FuYcrmc65V59tuwd2KiwmF9XSW/1aV9XF/0n1eLM2mD8hgvarS8WC1lF/r7vaBg8
Nq0iNqv7qmMJgNGkq/Px
=Mbru
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-01-07 11:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-05 16:09 [gentoo-portage-dev] [PATCH] emirrordist: support bsddb3 module (bug 570798) Zac Medico
2016-01-07 11:47 ` Alexander Berntsen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox