diff --git a/progressbar/__about__.py b/progressbar/__about__.py index 4294f43..6832fe2 100644 --- a/progressbar/__about__.py +++ b/progressbar/__about__.py @@ -19,7 +19,7 @@ long running operations. '''.strip().split()) __email__ = 'wolph@wol.ph' -__version__ = '3.53.2' +__version__ = '3.53.3' __license__ = 'BSD' __copyright__ = 'Copyright 2015 Rick van Hattem (Wolph)' __url__ = 'https://github.com/WoLpH/python-progressbar' diff --git a/progressbar/utils.py b/progressbar/utils.py index f1e2dd4..a9dc6f5 100644 --- a/progressbar/utils.py +++ b/progressbar/utils.py @@ -1,5 +1,4 @@ from __future__ import absolute_import -import distutils.util import atexit import io import os @@ -173,13 +172,15 @@ def env_flag(name, default=None): Accepts environt variables formatted as y/n, yes/no, 1/0, true/false, on/off, and returns it as a boolean - If the environt variable is not defined, or has an unknown value, returns - `default` + If the environment variable is not defined, or has an unknown value, + returns `default` ''' - try: - return bool(distutils.util.strtobool(os.environ.get(name, ''))) - except ValueError: - return default + v = os.getenv(name) + if v and v.lower() in ('y', 'yes', 't', 'true', 'on', '1'): + return True + if v and v.lower() in ('n', 'no', 'f', 'false', 'off', '0'): + return False + return default class WrappingIO: