Switch to new configparser backport.

This commit is contained in:
Itamar Turner-Trauring 2020-10-26 11:30:12 -04:00
parent f0657aec69
commit f50fd8e474
6 changed files with 19 additions and 20 deletions

View File

@ -131,6 +131,9 @@ install_requires = [
# Linux distribution detection:
"distro >= 1.4.0",
# Backported configparser for Python 2:
"configparser >= 5.0.1 ; python_version < '3.0'",
]
setup_requires = [

View File

@ -2,10 +2,9 @@ import os, stat, time, weakref
from base64 import urlsafe_b64encode
from functools import partial
from errno import ENOENT, EPERM
try:
from ConfigParser import NoSectionError
except ImportError:
from configparser import NoSectionError
# On Python 2 this will be the backported package:
from configparser import NoSectionError
from foolscap.furl import (
decode_furl,

View File

@ -13,8 +13,9 @@ from io import StringIO
import tempfile
from base64 import b32decode, b32encode
# Python 2 compatibility
from six.moves import configparser
# On Python 2 this will be the backported package.
import configparser
from future.utils import PY2
if PY2:
from io import BytesIO as StringIO # noqa: F811

View File

@ -8,7 +8,9 @@ from os.path import join
from future.utils import PY2
if PY2:
from future.builtins import str # noqa: F401
from six.moves.configparser import NoSectionError
# On Python 2 this will be the backported package:
from configparser import NoSectionError
from twisted.python import usage

View File

@ -31,12 +31,10 @@ the foolscap-based server implemented in src/allmydata/storage/*.py .
from past.builtins import unicode
import re, time, hashlib
try:
from ConfigParser import (
NoSectionError,
)
except ImportError:
from configparser import NoSectionError
# On Python 2 this will be the backport.
from configparser import NoSectionError
import attr
from zope.interface import (
Attribute,

View File

@ -16,13 +16,9 @@ if PY2:
# we do "r" or "w".
from builtins import filter, map, zip, ascii, chr, hex, input, next, oct, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401
if PY2:
# In theory on Python 2 configparser also works, but then code gets the
# wrong exceptions and they don't get handled. So just use native parser
# for now.
from ConfigParser import SafeConfigParser
else:
from configparser import SafeConfigParser
# On Python 2 we use the backport package; that means we always get unicode
# out.
from configparser import SafeConfigParser
import attr