From a998ae25de96cd4e11be48f639dead56886d9a8f Mon Sep 17 00:00:00 2001 From: Brian Dolbec Date: Sat, 9 Nov 2013 23:45:16 -0800 Subject: [PATCH] preliminary coding to make gkeyldap py3 capable --- gkeyldap/search.py | 12 +++++++++++- gkeys/config.py | 9 ++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/gkeyldap/search.py b/gkeyldap/search.py index 92471df..2cbc4b9 100644 --- a/gkeyldap/search.py +++ b/gkeyldap/search.py @@ -2,7 +2,17 @@ #-*- coding:utf-8 -*- -import ldap +try: + import ldap +except ImportError: + import sys + # py3.2 + if sys.hexversion >= 0x30200f0: + print('To run "ldap-seeds" in python 3, it requires a python3 ' + 'compatible version of dev-python/python-ldap be installed') + print('Currently only dev-python/python-ldap-9999 has that capability') + raise + from gkeys import log from gkeys.config import GKEY diff --git a/gkeys/config.py b/gkeys/config.py index fe78dec..5b220a8 100644 --- a/gkeys/config.py +++ b/gkeys/config.py @@ -11,7 +11,14 @@ """ import os -import ConfigParser +import sys + +# py3.2 +if sys.hexversion >= 0x30200f0: + import configparser as ConfigParser +else: + import ConfigParser + from collections import namedtuple -- 2.26.2