Skip to content

Commit

Permalink
Require configparser backport on 2.7
Browse files Browse the repository at this point in the history
Save ourselves some branches and it's hard to test without because
pytest depends on it.
  • Loading branch information
hynek committed Jun 8, 2019
1 parent 0041f1a commit 713ac3e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries :: Python Modules",
]
INSTALL_REQUIRES = ["attrs>=17.4.0"]
INSTALL_REQUIRES = ["attrs>=17.4.0", "configparser; python_version<'3.0'"]
EXTRAS_REQUIRE = {"tests": ["pytest", "coverage"]}
EXTRAS_REQUIRE["dev"] = EXTRAS_REQUIRE["tests"]

Expand Down
13 changes: 3 additions & 10 deletions src/environ/secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,14 @@
import logging
import sys

from configparser import NoOptionError, RawConfigParser

import attr

from ._environ_config import CNF_KEY, RAISE, _ConfigEntry
from .exceptions import MissingSecretError


try:
from configparser import RawConfigParser, NoOptionError
except ImportError:
from ConfigParser import RawConfigParser, NoOptionError


log = logging.getLogger(__name__)


Expand Down Expand Up @@ -168,9 +164,6 @@ def _load_ini(path):
"""
cfg = RawConfigParser()
with codecs.open(path, mode="r", encoding="utf-8") as f:
try:
cfg.read_file(f)
except AttributeError:
cfg.readfp(f)
cfg.read_file(f)

return cfg

0 comments on commit 713ac3e

Please sign in to comment.