Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bdrung committed Feb 29, 2024
1 parent 3b99c30 commit 335efe7
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,11 @@
"""Setup for bdebstrap"""

import logging
import os
import subprocess

import setuptools.command.build
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
import distutils.command.clean # isort:skip, pylint: disable=deprecated-module

HOOKS = ["hooks/disable-units", "hooks/enable-units"]
MAN_PAGES = ["bdebstrap.1"]

Expand All @@ -51,25 +46,14 @@ def run(self):
subprocess.check_call(command)


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

def run(self):
self.run_command("doc")
super().run()


class CleanCommand(distutils.command.clean.clean):
"""Custom clean command (removing generated man pages)."""

def run(self):
for man_page in MAN_PAGES:
if os.path.exists(man_page):
self.announce(f"removing {man_page}", level=logging.INFO)
os.remove(man_page)
distutils.command.clean.clean.run(self)


if __name__ == "__main__":
with open("README.md", "r", encoding="utf-8") as fh:
LONG_DESCRIPTION = fh.read()
Expand Down Expand Up @@ -97,7 +81,7 @@ def run(self):
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
],
cmdclass={"doc": DocCommand, "build": BuildCommand, "clean": CleanCommand},
cmdclass={"doc": DocCommand, "build": BuildCommand},
install_requires=["ruamel.yaml"],
scripts=["bdebstrap"],
py_modules=[],
Expand Down

0 comments on commit 335efe7

Please sign in to comment.