From 23a00d2df37e654878b11afbeab9da658acc12a4 Mon Sep 17 00:00:00 2001 From: richard Date: Thu, 16 Nov 2023 13:59:16 -0500 Subject: [PATCH] Replace Distutils in Preparation for Python 3.12 --- setup.py | 4 ++-- torchani/neurochem/parse_resources.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index 108cd730f..043389f0d 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ import os from packaging import version from setuptools import setup, find_packages -from distutils import log +import warnings import sys BUILD_CUAEV_ALL_SM = '--cuaev-all-sms' in sys.argv @@ -18,7 +18,7 @@ sys.argv.remove('--only-sm80') if not BUILD_CUAEV_ALL_SM and not FAST_BUILD_CUAEV: - log.warn("Will not install cuaev") # type: ignore + warnings.warn("Will not install cuaev") # type: ignore with open("README.md", "r") as fh: long_description = fh.read() diff --git a/torchani/neurochem/parse_resources.py b/torchani/neurochem/parse_resources.py index 8017f864e..dba0a5932 100644 --- a/torchani/neurochem/parse_resources.py +++ b/torchani/neurochem/parse_resources.py @@ -2,7 +2,7 @@ import io import requests import zipfile -from distutils import dir_util +import shutil from pathlib import Path @@ -47,8 +47,8 @@ def parse_neurochem_resources(info_file_path): resource_zip.extractall(local_dir) resource_path = local_dir source = os.path.join(resource_path, extracted_name, "resources") - dir_util.copy_tree(source, resource_path) - dir_util.remove_tree(os.path.join(resource_path, extracted_name)) + shutil.copytree(source, resource_path, dirs_exist_ok=True) + shutil.rmtree(os.path.join(resource_path, extracted_name)) else: raise ValueError('File {0} could not be found either in {1} or {2}\n'