mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-23 01:44:52 +01:00
py3k: The ConfigParser module has been renamed to configparser
This commit is contained in:
parent
676ce952d3
commit
4ed0362d41
2 changed files with 13 additions and 2 deletions
|
@ -17,7 +17,12 @@ import stat
|
||||||
import email
|
import email
|
||||||
|
|
||||||
from notmuch import Database, Query, NotmuchError, STATUS
|
from notmuch import Database, Query, NotmuchError, STATUS
|
||||||
from ConfigParser import SafeConfigParser
|
try:
|
||||||
|
# python3.x
|
||||||
|
from configparser import SafeConfigParser
|
||||||
|
except ImportError:
|
||||||
|
# python2.x
|
||||||
|
from ConfigParser import SafeConfigParser
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
|
|
||||||
PREFIX = re.compile('(\w+):(.*$)')
|
PREFIX = re.compile('(\w+):(.*$)')
|
||||||
|
|
|
@ -543,7 +543,13 @@ class Database(object):
|
||||||
""" Reads a user's notmuch config and returns his db location
|
""" Reads a user's notmuch config and returns his db location
|
||||||
|
|
||||||
Throws a NotmuchError if it cannot find it"""
|
Throws a NotmuchError if it cannot find it"""
|
||||||
|
try:
|
||||||
|
# python3.x
|
||||||
|
from configparser import SafeConfigParser
|
||||||
|
except ImportError:
|
||||||
|
# python2.x
|
||||||
from ConfigParser import SafeConfigParser
|
from ConfigParser import SafeConfigParser
|
||||||
|
|
||||||
config = SafeConfigParser()
|
config = SafeConfigParser()
|
||||||
conf_f = os.getenv('NOTMUCH_CONFIG',
|
conf_f = os.getenv('NOTMUCH_CONFIG',
|
||||||
os.path.expanduser('~/.notmuch-config'))
|
os.path.expanduser('~/.notmuch-config'))
|
||||||
|
|
Loading…
Reference in a new issue