mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-10-26 08:55:13 +03:00
build: use setuptools.command.build when available
Setuptools 62.4.0 adds setuptools.command.build to transparently replace the old distutils equivalent; hence, use it when available to fully switch away from distutils. Signed-off-by: Pino Toscano <ptoscano@redhat.com>
This commit is contained in:
parent
4f4e73d017
commit
231a3dbc87
23
setup.py
23
setup.py
@ -20,16 +20,17 @@ import subprocess
|
||||
import setuptools
|
||||
import setuptools.command.install
|
||||
import setuptools.command.install_egg_info
|
||||
|
||||
|
||||
# distutils will be deprecated in python 3.12 in favor of setuptools,
|
||||
# but as of this writing there's standard no setuptools way to extend the
|
||||
# 'build' commands which are the only standard commands we trigger.
|
||||
# https://github.com/pypa/setuptools/issues/2591
|
||||
#
|
||||
# Newer setuptools will transparently support 'import distutils' though.
|
||||
# That can be overridden with SETUPTOOLS_USE_DISTUTILS env variable
|
||||
import distutils.command.build # pylint: disable=wrong-import-order,deprecated-module,import-error
|
||||
try:
|
||||
# Use the setuptools build command with setuptools >= 62.4.0
|
||||
import setuptools.command.build
|
||||
BUILD_COMMAND_CLASS = setuptools.command.build.build
|
||||
except ImportError:
|
||||
# Use distutils with an older setuptools version
|
||||
#
|
||||
# Newer setuptools will transparently support 'import distutils' though.
|
||||
# That can be overridden with SETUPTOOLS_USE_DISTUTILS env variable
|
||||
import distutils.command.build # pylint: disable=wrong-import-order,deprecated-module,import-error
|
||||
BUILD_COMMAND_CLASS = distutils.command.build.build
|
||||
|
||||
|
||||
SYSPREFIX = sysconfig.get_config_var("prefix")
|
||||
@ -131,7 +132,7 @@ class my_build_i18n(setuptools.Command):
|
||||
self.distribution.data_files.append((target, files_merged))
|
||||
|
||||
|
||||
class my_build(distutils.command.build.build):
|
||||
class my_build(BUILD_COMMAND_CLASS):
|
||||
def _make_bin_wrappers(self):
|
||||
template = """#!/usr/bin/env python3
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user