Skip to content

Commit

Permalink
Remove reference to distutil
Browse files Browse the repository at this point in the history
Distutil has been removed in Python 3.12.

Tested by:
```
py -m libcst.tool codemod noop.NOOPCommand .\libcst\tool.py
Calculating full-repo metadata...
Executing codemod...
Finished codemodding 1 files!
 - Transformed 1 files successfully.
 - Skipped 0 files.
 - Failed to codemod 0 files.
 - 0 warnings were generated.
```
  • Loading branch information
zsol committed Feb 2, 2024
1 parent a2a60c1 commit b6f6ac8
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions libcst/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

import argparse
import dataclasses
import distutils.spawn
import importlib
import inspect
import os
import os.path
import shutil
import sys
import textwrap
from abc import ABC, abstractmethod
Expand Down Expand Up @@ -375,10 +375,7 @@ def _find_and_load_config(proc_name: str) -> Dict[str, Any]:

# Make sure that the formatter is findable.
if config["formatter"]:
exe = (
distutils.spawn.find_executable(config["formatter"][0])
or config["formatter"][0]
)
exe = shutil.which(config["formatter"][0]) or config["formatter"][0]
config["formatter"] = [os.path.abspath(exe), *config["formatter"][1:]]

return config
Expand Down

0 comments on commit b6f6ac8

Please sign in to comment.