mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Remove Sodium related deprecation warnings
Fixes #57516 Additionally, under Python 2, show and error when salt is imported and exit on CLI usage.
This commit is contained in:
parent
a1e2e401bd
commit
d79f3e4718
3 changed files with 15 additions and 33 deletions
|
@ -3,13 +3,18 @@
|
|||
Salt package
|
||||
"""
|
||||
|
||||
# Import Python libs
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
import importlib
|
||||
import sys
|
||||
import warnings
|
||||
|
||||
if sys.version_info < (3,):
|
||||
sys.stderr.write(
|
||||
"\n\nAfter the Sodium release, 3001, Salt no longer supports Python 2. Exiting.\n\n"
|
||||
)
|
||||
sys.stderr.flush()
|
||||
|
||||
|
||||
class TornadoImporter(object):
|
||||
def find_module(self, module_name, package_path=None):
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
This module contains the function calls to execute command line scripts
|
||||
"""
|
||||
|
||||
# Import python libs
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
import functools
|
||||
|
@ -17,13 +16,13 @@ import traceback
|
|||
from random import randint
|
||||
|
||||
import salt.defaults.exitcodes # pylint: disable=unused-import
|
||||
import salt.ext.six as six
|
||||
|
||||
# Import salt libs
|
||||
from salt.exceptions import SaltClientError, SaltReqTimeoutError, SaltSystemExit
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
if sys.version_info < (3,):
|
||||
raise SystemExit(salt.defaults.exitcodes.EX_GENERIC)
|
||||
|
||||
|
||||
def _handle_interrupt(exc, original_exc, hardfail=False, trace=""):
|
||||
"""
|
||||
|
@ -103,19 +102,6 @@ def salt_master():
|
|||
if __name__ != "__main__":
|
||||
sys.modules["__main__"] = sys.modules[__name__]
|
||||
|
||||
# REMOVEME after Python 2.7 support is dropped (also the six import)
|
||||
if six.PY2:
|
||||
from salt.utils.versions import warn_until
|
||||
|
||||
# Message borrowed from pip's deprecation warning
|
||||
warn_until(
|
||||
"Sodium",
|
||||
"Python 2.7 will reach the end of its life on January 1st,"
|
||||
" 2020. Please upgrade your Python as Python 2.7 won't be"
|
||||
" maintained after that date. Salt will drop support for"
|
||||
" Python 2.7 in the 3001 release or later.",
|
||||
)
|
||||
# END REMOVEME
|
||||
master = salt.cli.daemons.Master()
|
||||
master.start()
|
||||
|
||||
|
@ -212,19 +198,6 @@ def salt_minion():
|
|||
minion = salt.cli.daemons.Minion()
|
||||
minion.start()
|
||||
return
|
||||
# REMOVEME after Python 2.7 support is dropped (also the six import)
|
||||
elif six.PY2:
|
||||
from salt.utils.versions import warn_until
|
||||
|
||||
# Message borrowed from pip's deprecation warning
|
||||
warn_until(
|
||||
"Sodium",
|
||||
"Python 2.7 will reach the end of its life on January 1st,"
|
||||
" 2020. Please upgrade your Python as Python 2.7 won't be"
|
||||
" maintained after that date. Salt will drop support for"
|
||||
" Python 2.7 in the 3001 release or later.",
|
||||
)
|
||||
# END REMOVEME
|
||||
|
||||
if "--disable-keepalive" in sys.argv:
|
||||
sys.argv.remove("--disable-keepalive")
|
||||
|
|
8
setup.py
8
setup.py
|
@ -1071,8 +1071,12 @@ class SaltDistribution(distutils.dist.Distribution):
|
|||
return [
|
||||
"Programming Language :: Python",
|
||||
"Programming Language :: Cython",
|
||||
"Programming Language :: Python :: 2.6",
|
||||
"Programming Language :: Python :: 2.7",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3 :: Only",
|
||||
"Programming Language :: Python :: 3.5",
|
||||
"Programming Language :: Python :: 3.6",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Environment :: Console",
|
||||
"Intended Audience :: Developers",
|
||||
|
|
Loading…
Add table
Reference in a new issue