Skip to content

Commit

Permalink
Attempt to fix detection of locust-plugins version
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberw committed Dec 1, 2022
1 parent cf19ed0 commit fadbe17
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"],
},
Expand Down

0 comments on commit fadbe17

Please sign in to comment.