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 6df9ed5
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,9 @@
import os
import subprocess

import setuptools.command.install
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 +47,14 @@ def run(self):
subprocess.check_call(command)


class BuildCommand(distutils.command.build.build):
class BuildCommand(setuptools.command.install.install):
"""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 +82,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 6df9ed5

Please sign in to comment.