Skip to content

Commit

Permalink
setup: replace distutils.command.build by setuptools.command.build
Browse files Browse the repository at this point in the history
Support removed `distutils` in Python 3.12.

Bug: #12
Signed-off-by: Benjamin Drung <[email protected]>
  • Loading branch information
bdrung committed Mar 1, 2024
1 parent 1009d7f commit 7d74e9c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@

from setuptools import Command, setup

# Setuptools replaces the `distutils` module in `sys.modules`.
# pylint: disable=wrong-import-order
import distutils.command.build # isort:skip, pylint: disable=deprecated-module
try:
from setuptools.command.build import build
except ImportError:
# Fallback for setuptools < 60 and Python < 3.12
from distutils.command.build import build # pylint: disable=deprecated-module

HOOKS = ["hooks/disable-units", "hooks/enable-units"]
MAN_PAGES = ["bdebstrap.1"]
Expand Down Expand Up @@ -52,7 +54,7 @@ def run(self) -> None:
subprocess.check_call(command)


class BuildCommand(distutils.command.build.build):
class BuildCommand(build):
"""Custom build command (calling doc beforehand)."""

def run(self) -> None:
Expand Down

0 comments on commit 7d74e9c

Please sign in to comment.