From 37142e674497e0cbebb4b76099db108ee0a0386e Mon Sep 17 00:00:00 2001 From: vrenaville Date: Thu, 28 Nov 2024 13:45:22 +0100 Subject: [PATCH] feat: remove distutils --- HISTORY.rst | 2 ++ marabunta/config.py | 2 +- marabunta/strtobool.py | 21 +++++++++++++++++++++ setup.py | 11 ++++++----- 4 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 marabunta/strtobool.py diff --git a/HISTORY.rst b/HISTORY.rst index 7d004c1..3094ed8 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -12,6 +12,8 @@ Unreleased **Bugfixes** +* move from disutils (removed on python 3.12) to setuptools + **Improvements** * I18N overwrite option diff --git a/marabunta/config.py b/marabunta/config.py index 99dfb41..e0994f3 100644 --- a/marabunta/config.py +++ b/marabunta/config.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Copyright 2016-2017 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) -from distutils.util import strtobool +from .strtobool import strtobool import argparse import os diff --git a/marabunta/strtobool.py b/marabunta/strtobool.py new file mode 100644 index 0000000..1a7ad55 --- /dev/null +++ b/marabunta/strtobool.py @@ -0,0 +1,21 @@ +_MAP = { + "y": True, + "yes": True, + "t": True, + "true": True, + "on": True, + "1": True, + "n": False, + "no": False, + "f": False, + "false": False, + "off": False, + "0": False, +} + + +def strtobool(value): + try: + return _MAP[str(value).lower()] + except KeyError as error: + raise ValueError(f'"{value}" is not a valid bool value') from error diff --git a/setup.py b/setup.py index 8a7fa57..009aaeb 100644 --- a/setup.py +++ b/setup.py @@ -32,11 +32,12 @@ license='AGPLv3+', packages=find_packages(exclude=('tests', 'docs')), install_requires=[ - "psycopg2", - "ruamel.yaml>=0.15.1", - "pexpect", - "werkzeug", - "future", + #"psycopg2", + #"ruamel.yaml>=0.15.1", + #"pexpect", + #"werkzeug", + #"setuptools", + #"future", ], setup_requires=[ 'setuptools_scm',