Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated distutils module in Python 3.12 #2948

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion bin/mrtrix3.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# For more details, see http://www.mrtrix.org/.

import os, sys
from distutils.spawn import find_executable

try:
# since importlib code below only works on Python 3.5+
Expand Down
7 changes: 6 additions & 1 deletion lib/mrtrix3/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,18 @@


import ctypes, errno, inspect, os, random, string, subprocess, time
from distutils.spawn import find_executable
# Function can be used in isolation if potentially needing to place quotation marks around a
# filesystem path that is to be included as part of a command string
try:
from shlex import quote
except ImportError:
from pipes import quote
# Distutils removed in 3.12, but shutil.which not available in 2.7
try:
from shutil import which as find_executable
except ImportError:
from distutils.spawn import find_executable

from mrtrix3 import CONFIG
from mrtrix3.utils import STRING_TYPES

Expand Down
7 changes: 6 additions & 1 deletion lib/mrtrix3/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@
# pylint: disable=unspecified-encoding

import collections, itertools, os, shlex, signal, string, subprocess, sys, tempfile, threading
from distutils.spawn import find_executable
from mrtrix3 import ANSI, BIN_PATH, COMMAND_HISTORY_STRING, EXE_LIST, MRtrixBaseError, MRtrixError
from mrtrix3.utils import STRING_TYPES

# Distutils removed in 3.12, but shutil.which not available in 2.7
try:
from shutil import which as find_executable
except ImportError:
from distutils.spawn import find_executable

IOStream = collections.namedtuple('IOStream', 'handle filename')


Expand Down
Loading