Fix duplicate console_scripts entry under windows

This commit is contained in:
Pedro Algarvio 2020-08-20 19:31:13 +01:00
parent 86a86e6b58
commit 9ba8caf26d
No known key found for this signature in database
GPG key ID: BB36BF6584A298FF

View file

@ -1,5 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
The setup script for salt
"""
@ -9,7 +8,6 @@ The setup script for salt
# pylint: disable=C0111,E1101,E1103,F0401,W0611,W0201,W0232,R0201,R0902,R0903
# For Python 2.5. A no-op on 2.6 and above.
from __future__ import absolute_import, print_function, with_statement
import contextlib
import distutils.dist
@ -492,7 +490,7 @@ class DownloadWindowsDlls(Command):
fdest = dest.format(fname=fname)
if not os.path.exists(fdest):
log.info(
"Downloading {0}.dll to {1} from {2}".format(fname, fdest, furl)
"Downloading {}.dll to {} from {}".format(fname, fdest, furl)
)
try:
import requests
@ -507,7 +505,7 @@ class DownloadWindowsDlls(Command):
wfh.flush()
else:
log.error(
"Failed to download {0}.dll to {1} from {2}".format(
"Failed to download {}.dll to {} from {}".format(
fname, fdest, furl
)
)
@ -519,7 +517,7 @@ class DownloadWindowsDlls(Command):
if IS_PY3:
while True:
chunk = req.read(4096)
if len(chunk) == 0:
if not chunk:
break
wfh.write(chunk)
wfh.flush()
@ -532,7 +530,7 @@ class DownloadWindowsDlls(Command):
wfh.flush()
else:
log.error(
"Failed to download {0}.dll to {1} from {2}".format(
"Failed to download {}.dll to {} from {}".format(
fname, fdest, furl
)
)
@ -608,7 +606,7 @@ class CloudSdist(Sdist): # pylint: disable=too-many-ancestors
# Let's update the bootstrap-script to the version defined to be
# distributed. See BOOTSTRAP_SCRIPT_DISTRIBUTED_VERSION above.
url = (
"https://github.com/saltstack/salt-bootstrap/raw/{0}"
"https://github.com/saltstack/salt-bootstrap/raw/{}"
"/bootstrap-salt.sh".format(BOOTSTRAP_SCRIPT_DISTRIBUTED_VERSION)
)
deploy_path = os.path.join(
@ -616,8 +614,8 @@ class CloudSdist(Sdist): # pylint: disable=too-many-ancestors
)
log.info(
"Updating bootstrap-salt.sh."
"\n\tSource: {0}"
"\n\tDestination: {1}".format(url, deploy_path)
"\n\tSource: {}"
"\n\tDestination: {}".format(url, deploy_path)
)
try:
@ -629,7 +627,7 @@ class CloudSdist(Sdist): # pylint: disable=too-many-ancestors
else:
log.error(
"Failed to update the bootstrap-salt.sh script. HTTP "
"Error code: {0}".format(req.status_code)
"Error code: {}".format(req.status_code)
)
except ImportError:
req = urlopen(url)
@ -639,13 +637,13 @@ class CloudSdist(Sdist): # pylint: disable=too-many-ancestors
else:
log.error(
"Failed to update the bootstrap-salt.sh script. HTTP "
"Error code: {0}".format(req.getcode())
"Error code: {}".format(req.getcode())
)
try:
with open(deploy_path, "w") as fp_:
fp_.write(script_contents)
except (OSError, IOError) as err:
log.error("Failed to write the updated script: {0}".format(err))
except OSError as err:
log.error("Failed to write the updated script: {}".format(err))
# Let's the rest of the build command
Sdist.run(self)
@ -681,9 +679,9 @@ class TestCommand(Command):
self.run_command("build")
build_cmd = self.get_finalized_command("build_ext")
runner = os.path.abspath("tests/runtests.py")
test_cmd = sys.executable + " {0}".format(runner)
test_cmd = sys.executable + " {}".format(runner)
if self.runtests_opts:
test_cmd += " {0}".format(self.runtests_opts)
test_cmd += " {}".format(self.runtests_opts)
print("running test")
test_process = Popen(
@ -704,7 +702,7 @@ class Clean(clean):
for subdir in ("salt", "tests", "doc"):
root = os.path.join(os.path.dirname(__file__), subdir)
for dirname, _, _ in os.walk(root):
for to_remove_filename in glob.glob("{0}/*.py[oc]".format(dirname)):
for to_remove_filename in glob.glob("{}/*.py[oc]".format(dirname)):
os.remove(to_remove_filename)
@ -1049,8 +1047,8 @@ class SaltDistribution(distutils.dist.Distribution):
continue
if attrname == "salt_version":
attrname = "version"
if hasattr(self.metadata, "set_{0}".format(attrname)):
getattr(self.metadata, "set_{0}".format(attrname))(attrvalue)
if hasattr(self.metadata, "set_{}".format(attrname)):
getattr(self.metadata, "set_{}".format(attrname))(attrvalue)
elif hasattr(self.metadata, attrname):
try:
setattr(self.metadata, attrname, attrvalue)
@ -1250,7 +1248,7 @@ class SaltDistribution(distutils.dist.Distribution):
if IS_WINDOWS_PLATFORM:
scripts.extend(
[
"salt-cp = salt.scripts:salt_api",
"salt-api = salt.scripts:salt_api",
"salt-cp = salt.scripts:salt_cp",
"salt-key = salt.scripts:salt_key",
"salt-minion = salt.scripts:salt_minion",
@ -1400,7 +1398,7 @@ class SaltDistribution(distutils.dist.Distribution):
if self.salt_transport not in ("zeromq", "both", "ssh", "none"):
raise DistutilsArgError(
"The value of --salt-transport needs be 'zeromq', "
"'both', 'ssh', or 'none' not '{0}'".format(self.salt_transport)
"'both', 'ssh', or 'none' not '{}'".format(self.salt_transport)
)
# Setup our property functions after class initialization and