From df38dcc20748c99d4422010b46b1610300535538 Mon Sep 17 00:00:00 2001 From: Alfred Wingate Date: Thu, 5 Oct 2023 07:11:38 +0300 Subject: setup.py: Convert to setuptools * Remove clean command as setuptools doesn't have equivalent target. Signed-off-by: Alfred Wingate --- setup.py | 57 +++++---------------------------------------------------- 1 file changed, 5 insertions(+), 52 deletions(-) diff --git a/setup.py b/setup.py index 4effd2e..525126e 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,9 @@ -from distutils.core import setup -from distutils.cmd import Command from distutils.file_util import copy_file -from distutils.dir_util import remove_tree -from distutils.command.build import build as _build -from distutils.command.install import install as _install -from distutils.command.clean import clean as _clean + +from setuptools import setup +from setuptools import Command +from setuptools.command.build import build as _build +from setuptools.command.install import install as _install import logging @@ -159,51 +158,6 @@ class install_messages(Command): copy_file(c, out_file) -class clean(_clean): - _clean.user_options.append( - ('build-messages=', None, - "build directory for messages (default: 'build.build-messages')")) - - def initialize_options(self): - _clean.initialize_options(self) - self.build_messages = None - - def finalize_options(self): - self.set_undefined_options('build', ('build_base', 'build_base'), - ('build_lib', 'build_lib'), - ('build_scripts', 'build_scripts'), - ('build_temp', 'build_temp'), - ('build_messages', 'build_messages')) - self.set_undefined_options('bdist', ('bdist_base', 'bdist_base')) - - def run(self): - # remove the build/temp. directory (unless it's already - # gone) - if os.path.exists(self.build_temp): - remove_tree(self.build_temp, dry_run=self.dry_run) - else: - logging.debug("'%s' does not exist -- can't clean it", self.build_temp) - - if self.all: - # remove build directories - for directory in (self.build_lib, self.bdist_base, - self.build_scripts, self.build_messages): - if os.path.exists(directory): - remove_tree(directory, dry_run=self.dry_run) - else: - logging.warn("'%s' does not exist -- can't clean it", - directory) - - # just for the heck of it, try to remove the base build directory: - # we might have emptied it right now, but if not we don't care - if not self.dry_run: - try: - os.rmdir(self.build_base) - logging.info("removing '%s'", self.build_base) - except OSError: - pass - - ## Class modified to add manpages command class install(_install): def has_messages(self): @@ -269,5 +223,4 @@ setup(name="elogv", 'install_messages': install_messages, 'install_manpages': install_manpages, 'install': install, - 'clean': clean }) -- cgit v1.2.3-65-gdbad