From c545f52348f3eec9e1a40732646a22c8481817cc Mon Sep 17 00:00:00 2001 From: jan Iversen Date: Sun, 19 Feb 2023 19:33:44 +0100 Subject: [PATCH] Remove unused setup_commands.py. --- setup.cfg | 7 +-- setup.py | 7 --- setup_commands.py | 140 ---------------------------------------------- 3 files changed, 1 insertion(+), 153 deletions(-) delete mode 100755 setup_commands.py diff --git a/setup.cfg b/setup.cfg index fabcd2577..c2a52dbb1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -500,16 +500,11 @@ ignore = W503 noqa-require-code = True + [mypy] strict_optional = False -[aliases] -upload_docs = build_sphinx upload_docs -package = build_apidocs build_sphinx sdist -test=pytest - - [egg_info] tag_svn_revision = false diff --git a/setup.py b/setup.py index 120e3d09a..1551b2dd6 100644 --- a/setup.py +++ b/setup.py @@ -8,12 +8,6 @@ from setuptools import setup -try: - from setup_commands import command_classes -except ImportError: - command_classes = {} - - dependencies = {} with open("requirements.txt") as reqs: option = None @@ -36,5 +30,4 @@ setup( install_requires=install_req, extras_require=dependencies, - cmdclass=command_classes, ) diff --git a/setup_commands.py b/setup_commands.py deleted file mode 100755 index 2897eb980..000000000 --- a/setup_commands.py +++ /dev/null @@ -1,140 +0,0 @@ -"""Setup commands.""" -import os -import shutil -import sys - -from setuptools import Command - - -# --------------------------------------------------------------------------- # -# Extra Commands -# --------------------------------------------------------------------------- # - - -class BuildApiDocsCommand(Command): - """Helper command to build the available api documents. - - This scans all the subdirectories under api and runs the - build.py script underneath trying to build the api - documentation for the given format. - """ - - description = "build all the project's api documents" - user_options = [] - - def initialize_options(self): - """Initialize options setup.""" - if not os.path.exists("./build"): - os.mkdir("./build") - - def finalize_options(self): - """Finalize options teardown.""" - pass - - def run(self): - """Run command.""" - old_cwd = os.getcwd() - directories = (d for d in os.listdir("./doc/api") if not d.startswith(".")) - for entry in directories: - os.chdir("./doc/api/%s" % entry) - os.system("python build.py") - os.chdir(old_cwd) - - -class DeepCleanCommand(Command): - """Helper command to return the directory to a completely clean state.""" - - description = "clean everything that we don't want" - user_options = [] - trash = [ - "build", - "dist", - "pymodbus.egg-info", - os.path.join(os.path.join("doc", "sphinx"), "build"), - ] - - def initialize_options(self): - """Initialize options setup.""" - pass - - def finalize_options(self): - pass - - def run(self): - """Run command.""" - self._delete_pyc_files() - self._delete_trash_dirs() - - def _delete_trash_dirs(self): - """Remove all directories created in building.""" - self._delete_pyc_files() - for directory in self.trash: - if os.path.exists(directory): - shutil.rmtree(directory) - - @staticmethod - def _delete_pyc_files(): - """Remove all python cache files.""" - for root, dirs, files in os.walk("."): - for file in files: - if file.endswith(".pyc"): - os.remove(os.path.join(root, file)) - - -class LintCommand(Command): - """Helper command to perform a lint scan of the sourcecode and return the results.""" - - description = "perform a lint scan of the code" - user_options = [] - - def initialize_options(self): - """Initialize options setup.""" - if not os.path.exists("./build"): - os.mkdir("./build") - - def finalize_options(self): - pass - - def run(self): - """Run command.""" - scanners = [s for s in dir(self) if s.find("__try") >= 0] - for scanner in scanners: - if getattr(self, scanner)(): - break - - def _try_pyflakes(self): - try: - from pyflakes.scripts.pyflakes import main - - sys.argv = """pyflakes pymodbus""".split() - main() - return True - except Exception: - return False - - def _try_pylint(self): - try: - import pylint - - sys.argv = """pylint pymodbus/*.py""".split() - pylint.main() - return True - except Exception: - return False - - -# --------------------------------------------------------------------------- # -# Command Configuration -# --------------------------------------------------------------------------- # - - -command_classes = { - "deep_clean": DeepCleanCommand, - "build_apidocs": BuildApiDocsCommand, - "lint": LintCommand, -} - -# --------------------------------------------------------------------------- # -# Export command list -# --------------------------------------------------------------------------- # -__all__ = ["command_classes"]