From 72fcfbfb79c68536264798ee6b8061371f43d18c Mon Sep 17 00:00:00 2001 From: kumattau Date: Fri, 24 Dec 2021 23:43:04 +0900 Subject: [PATCH] Replace now deprecated distutils with setuptools --- setup.py | 8 ++------ setupbase.py | 21 +++++++++++---------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/setup.py b/setup.py index c0ab7d5b..c6f826b1 100644 --- a/setup.py +++ b/setup.py @@ -2,12 +2,8 @@ import os import io -try: - from setuptools import setup - from setuptools.command.install import install -except ImportError: - from distutils.core import setup - from distutils.core.command.install import install +from setuptools import setup +from setuptools.command.install import install # Code to add custom build commands comes from here: import setupbase diff --git a/setupbase.py b/setupbase.py index 08fe165c..ed6cc81a 100644 --- a/setupbase.py +++ b/setupbase.py @@ -17,8 +17,9 @@ from urllib.request import urlopen -import distutils.cmd -import distutils.log +import setuptools + +LOG_INFO = 2 HERE = os.path.abspath(os.path.dirname(__file__)) ICONIC_FONT_PY_PATH = os.path.join(HERE, 'qtawesome', 'iconic_font.py') @@ -74,7 +75,7 @@ def rename_font(font_path, font_name): f"ERROR: unable to write new name to OpenType tables for: {font_path}") -class UpdateFA5Command(distutils.cmd.Command): +class UpdateFA5Command(setuptools.Command): """A custom command to make updating FontAwesome 5.x easy!""" description = 'Try to update the FontAwesome 5.x data in the project.' user_options = [ @@ -102,8 +103,8 @@ def finalize_options(self): 'Local zipfile does not exist: %s' % self.zip_path) def __print(self, msg): - """Shortcut for printing with the distutils logger.""" - self.announce(msg, level=distutils.log.INFO) + """Shortcut for printing with the setuptools logger.""" + self.announce(msg, level=LOG_INFO) def __get_charmap_path(self, style): """Get the project FA charmap path for a given style.""" @@ -232,7 +233,7 @@ def run(self): 'qtawesome/docs/source/usage.rst to reflect the changes.') -class UpdateCodiconCommand(distutils.cmd.Command): +class UpdateCodiconCommand(setuptools.Command): """A custom command to make updating Microsoft's Codicons easy!""" description = 'Try to update the Codicon font data in the project.' user_options = [] @@ -245,14 +246,14 @@ class UpdateCodiconCommand(distutils.cmd.Command): DOWNLOAD_URL_JSON = 'https://raw.githubusercontent.com/microsoft/vscode-codicons/master/package.json' def initialize_options(self): - """Required by distutils.""" + """Required by setuptools.""" def finalize_options(self): - """Required by distutils.""" + """Required by setuptools.""" def __print(self, msg): - """Shortcut for printing with the distutils logger.""" - self.announce(msg, level=distutils.log.INFO) + """Shortcut for printing with the setuptools logger.""" + self.announce(msg, level=LOG_INFO) def run(self): """Run command."""