Skip to content

Commit

Permalink
Merge pull request #199 from kumattau/prioritize-setuptools
Browse files Browse the repository at this point in the history
PR: Replace now deprecated distutils with setuptools
  • Loading branch information
dalthviz authored Dec 24, 2021
2 parents ae9acfc + 72fcfbf commit a31fa28
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
8 changes: 2 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 11 additions & 10 deletions setupbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__))
INIT_PY_PATH = os.path.join(HERE, 'qtawesome', '__init__.py')
Expand Down Expand Up @@ -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 = [
Expand Down Expand Up @@ -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."""
Expand Down Expand Up @@ -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 = []
Expand All @@ -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."""
Expand Down

0 comments on commit a31fa28

Please sign in to comment.