# Buggy code
def run(self):
    from distutils.version import StrictVersion

    if StrictVersion(setuptools.__version__) < StrictVersion("9.1"):
        sys.stderr.write(
            "\n\nInstalling Salt requires setuptools >= 9.1\n"
            "Available setuptools version is {}\n\n".format(setuptools.__version__)
        )
        sys.stderr.flush()
        sys.exit(1)

    # Let's set the running_salt_install attribute so we can add
    # _version.py in the build command
    self.distribution.running_salt_install = True
    self.distribution.salt_version_hardcoded_path = os.path.join(
        self.build_lib, "salt", "_version.py"
    )
    if IS_WINDOWS_PLATFORM:
        # Download the required DLLs
        self.distribution.salt_download_windows_dlls = True
        self.run_command("download-windows-dlls")
        self.distribution.salt_download_windows_dlls = None
    # Run install.run
    install.run(self)


# Traceback (ValueError)
running install
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-oy9w2_9m/salt/setup.py", line 1241, in <module>
setup(distclass=SaltDistribution)
File "/opt/miniconda/envs/testenv/lib/python3.6/site-packages/setuptools/__init__.py", line 144, in setup
return distutils.core.setup(**attrs)
File "/opt/miniconda/envs/testenv/lib/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/opt/miniconda/envs/testenv/lib/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/opt/miniconda/envs/testenv/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/opt/miniconda/envs/testenv/lib/python3.6/site-packages/wheel/bdist_wheel.py", line 259, in run
self.run_command('install')
File "/opt/miniconda/envs/testenv/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/opt/miniconda/envs/testenv/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/pip-install-oy9w2_9m/salt/setup.py", line 704, in run
if StrictVersion(setuptools.__version__) < StrictVersion('9.1'):
File "/opt/miniconda/envs/testenv/lib/python3.6/distutils/version.py", line 40, in __init__
self.parse(vstring)
File "/opt/miniconda/envs/testenv/lib/python3.6/distutils/version.py", line 137, in parse
raise ValueError("invalid version number '%s'" % vstring)
ValueError: invalid version number '45.2.0.post20200210'
----------------------------------------
ERROR: Failed building wheel for salt

# Fixed code
def run(self):
    if LooseVersion(setuptools.__version__) < LooseVersion("9.1"):
        sys.stderr.write(
            "\n\nInstalling Salt requires setuptools >= 9.1\n"
            "Available setuptools version is {}\n\n".format(setuptools.__version__)
        )
        sys.stderr.flush()
        sys.exit(1)

    # Let's set the running_salt_install attribute so we can add
    # _version.py in the build command
    self.distribution.running_salt_install = True
    self.distribution.salt_version_hardcoded_path = os.path.join(
        self.build_lib, "salt", "_version.py"
    )
    if IS_WINDOWS_PLATFORM:
        # Download the required DLLs
        self.distribution.salt_download_windows_dlls = True
        self.run_command("download-windows-dlls")
        self.distribution.salt_download_windows_dlls = None
    # Run install.run
    install.run(self)