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

remove remaining distutils references #4721

Merged
merged 2 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions CIME/Tools/code_checker
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ from CIME.code_checker import check_code, expect
import argparse, sys, os

# pylint: disable=import-error
from distutils.spawn import find_executable
from shutils import which

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -62,7 +62,7 @@ OR
###############################################################################
def _main_func(description):
###############################################################################
pylint = find_executable("pylint")
pylint = which("pylint")
expect(pylint is not None, "pylint not found")

num_procs, files = parse_command_line(sys.argv, description)
Expand Down
4 changes: 2 additions & 2 deletions CIME/Tools/xmlconvertors/config_pes_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from CIME import utils
from CIME.Tools.standard_script_setup import *
from CIME.utils import run_cmd
from distutils.spawn import find_executable
from shutils import which
import xml.etree.ElementTree as ET
import grid_xml_converter

Expand Down Expand Up @@ -242,7 +242,7 @@ def writexml(self, addlist, newfilename):
root.append(ET.Element("WITH"))
if a is not None:
root.append(a.to_cime5())
xmllint = find_executable("xmllint")
xmllint = which("xmllint")
if xmllint is not None:
run_cmd(
"{} --format --output {} -".format(xmllint, newfilename),
Expand Down
19 changes: 9 additions & 10 deletions CIME/Tools/xmlconvertors/grid_xml_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from CIME import utils
from CIME.Tools.standard_script_setup import *
from CIME.utils import run_cmd_no_fail
from distutils.spawn import find_executable
from shutils import which
import xml.etree.ElementTree as ET
import operator

Expand Down Expand Up @@ -307,6 +307,7 @@ def __init__(self, xmlfilename):
self.n = 0
self.nodes = []
self.populate()
self._xmllint = which(xmllint)

def next(self):
if self.index >= len(self.nodes):
Expand Down Expand Up @@ -358,10 +359,9 @@ def writexml(self, addlist, newfilename):

if a is not None:
grids.append(a.to_cime5())
xmllint = find_executable("xmllint")
if xmllint is not None:
if self._xmllint is not None:
run_cmd_no_fail(
"{} --format --output {} -".format(xmllint, newfilename),
"{} --format --output {} -".format(self._xmllint, newfilename),
input_str=ET.tostring(root),
)

Expand Down Expand Up @@ -392,10 +392,10 @@ def writexml(self, addlist, newfilename):
domains.append(ET.Element("WITH"))
if a is not None:
domains.append(a.to_cime5())
xmllint = find_executable("xmllint")
if xmllint is not None:

if self._xmllint is not None:
run_cmd_no_fail(
"{} --format --output {} -".format(xmllint, newfilename),
"{} --format --output {} -".format(self._xmllint, newfilename),
input_str=ET.tostring(root),
)

Expand All @@ -422,10 +422,9 @@ def writexml(self, addlist, newfilename):
gridmaps.append(ET.Element("WITH"))
if a is not None:
gridmaps.append(a.to_cime5())
xmllint = find_executable("xmllint")
if xmllint is not None:
if self._xmllint is not None:
run_cmd_no_fail(
"{} --format --output {} -".format(xmllint, newfilename),
"{} --format --output {} -".format(self._xmllint, newfilename),
input_str=ET.tostring(root),
)

Expand Down
Loading