From 20483823a58fbfba1243586ef1bd4bedec39cb11 Mon Sep 17 00:00:00 2001 From: taha- <126220185+Ahmeds-Data@users.noreply.github.com> Date: Sat, 14 Sep 2024 04:43:34 +0800 Subject: [PATCH] Update functionality in `versioneer.py` and `setup.py` - Updated `SafeConfigParser` to `ConfigParser` in `versioneer.py` to align with Python 3.2+ standards. - Replaced deprecated `readfp` method with `read_file` in `versioneer.py`. - Changed import statement to `import sysconfig` in `setup.py`. - Fixed architecture check condition to verify 64-bit Python in `setup.py`. - Updated include directories retrieval in `setup.py` to match changes in `sysconfig` API. --- setup.py | 6 +++--- versioneer.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index 300c1be6..53d97472 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -from distutils import sysconfig +import sysconfig import platform import numpy @@ -8,10 +8,10 @@ import versioneer if platform.architecture()[0].startswith('32'): - raise Exception('PyRadiomics requires 64 bits python') + raise Exception('PyRadiomics requires 64 bits python') commands = versioneer.get_cmdclass() -incDirs = [sysconfig.get_python_inc(), numpy.get_include()] +incDirs = [sysconfig.get_paths()['include'], numpy.get_include()] ext = [Extension("radiomics._cmatrices", ["radiomics/src/_cmatrices.c", "radiomics/src/cmatrices.c"], include_dirs=incDirs), diff --git a/versioneer.py b/versioneer.py index f250cde5..2dddf8b5 100644 --- a/versioneer.py +++ b/versioneer.py @@ -339,9 +339,9 @@ def get_config_from_root(root): # configparser.NoOptionError (if it lacks "VCS="). See the docstring at # the top of versioneer.py for instructions on writing your setup.cfg . setup_cfg = os.path.join(root, "setup.cfg") - parser = configparser.SafeConfigParser() + parser = configparser.ConfigParser() with open(setup_cfg, "r") as f: - parser.readfp(f) + parser.read_file(f) VCS = parser.get("versioneer", "VCS") # mandatory def get(parser, name):