diff --git a/setup.py b/setup.py index 6980ed0..39b43b8 100644 --- a/setup.py +++ b/setup.py @@ -10,37 +10,37 @@ from setuptools.command.develop import develop +def install_check(self, command): + try: + import locust_plugins # noqa + + major, minor, _patch = locust_plugins.__version__.split(".") + if int(major) < 2 or int(major) == 2 and int(minor) < 7: + sys.exit( + "Please update (or uninstall) locust-plugins, your version is not compatible with this version of locust-swarm" + ) + except ImportError: + pass # plugins wasnt installed, no worries + if os.name == "nt": + sys.exit("Looks like you are on windows. Only MacOS and Linux are supported :(") + command.run(self) + + class PostDevelopCommand(develop): def run(self): - if os.name == "nt": - sys.exit("Looks like you are on windows. Only MacOS and Linux are supported :(") - develop.run(self) + install_check(self, develop) class PostInstallCommand(install): def run(self): - if os.name == "nt": - sys.exit("Looks like you are on windows. Only MacOS and Linux are supported :(") - install.run(self) + install_check(self, install) class PostEggInfoCommand(egg_info): def run(self): - if os.name == "nt": - sys.exit("Looks like you are on windows. Only MacOS and Linux are supported :(") - egg_info.run(self) + install_check(self, egg_info) -requirements_list = [ - "keyring==21.4.0", - "psutil", - "ConfigArgParse>=1.0", -] -# if locust-plugins IS installed, then require a version known to work with this version of swarm. -spec = importlib.util.find_spec("locust_plugins") -if spec is not None: - requirements_list.append("locust-plugins>=2.7.0") - setup( name="locust-swarm", description="Load test + test data distribution & launching tool for Locust", @@ -68,7 +68,11 @@ def run(self): packages=find_packages(), include_package_data=True, zip_safe=False, - install_requires=requirements_list, + install_requires=[ + "keyring==21.4.0", + "psutil", + "ConfigArgParse>=1.0", + ], entry_points={ "console_scripts": ["swarm = locust_swarm.swarm:main"], },