From 236d2f6985e364dcf30c0a20660ffbe374beec3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Mon, 13 Sep 2021 21:20:49 +0200 Subject: [PATCH 1/2] Stop using deprecated distutils.util Using distutils emits a DeprecationWarning with python 3.10 at runtime. (And the module is slated for removal in python 3.12.) The list of accepted strings is taken from https://docs.python.org/3/distutils/apiref.html#distutils.util.strtobool --- progressbar/utils.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) 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: From 8a96eef31924487132d8f5dc58c3eb8bb1add269 Mon Sep 17 00:00:00 2001 From: Rick van Hattem Date: Wed, 15 Sep 2021 00:42:42 +0200 Subject: [PATCH 2/2] Incrementing version to v3.53.3 --- progressbar/__about__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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'