Remove references to sys.version_info

We support Python 3.6 as a minimum now, making these checks no-ops.

Change-Id: Ia4b1eec7a788cb1ede3dc338f7be7e5d8a84069d
This commit is contained in:
songwenping 2021-05-28 01:52:20 +00:00 committed by Wenping Song
parent 8aac7f807d
commit 22e822dde2
7 changed files with 2 additions and 49 deletions

View File

@ -16,7 +16,6 @@ import copy
import datetime
import eventlet
import random
import sys
import threading
from oslo_config import cfg
@ -97,13 +96,6 @@ class DefaultScheduler(base.Scheduler):
" due to unexpected exception."
)
# For some mysterious reason (probably eventlet related)
# the exception is not cleared from the context automatically.
# This results in subsequent log.warning calls to show invalid
# info.
if sys.version_info < (3,):
sys.exc_clear()
def _process_store_jobs(self):
# Select and capture eligible jobs.
with db_api.transaction():

View File

@ -14,7 +14,6 @@
import datetime
import eventlet
import sys
from mistral import context as auth_ctx
from mistral.db import utils as db_utils
@ -92,13 +91,6 @@ def _loop():
' due to an unexpected exception.'
)
# For some mysterious reason (probably eventlet related)
# the exception is not cleared from the context automatically.
# This results in subsequent log.warning calls to show invalid
# info.
if sys.version_info < (3,):
sys.exc_clear()
eventlet.sleep(CONF.action_heartbeat.check_interval)

View File

@ -13,7 +13,6 @@
# limitations under the License.
import eventlet
import sys
from oslo_config import cfg
from oslo_log import log as logging
@ -83,13 +82,6 @@ def _loop():
' due to an unexpected exception.'
)
# For some mysterious reason (probably eventlet related)
# the exception is not cleared from the context automatically.
# This results in subsequent log.warning calls to show invalid
# info.
if sys.version_info < (3,):
sys.exc_clear()
eventlet.sleep(CONF.action_heartbeat.check_interval)

View File

@ -18,7 +18,6 @@ import copy
import datetime
import eventlet
import random
import sys
import threading
from oslo_config import cfg
@ -148,13 +147,6 @@ class LegacyScheduler(sched_base.Scheduler):
" due to unexpected exception."
)
# For some mysterious reason (probably eventlet related)
# the exception is not cleared from the context automatically.
# This results in subsequent log.warning calls to show invalid
# info.
if sys.version_info < (3,):
sys.exc_clear()
eventlet.sleep(
self._fixed_delay +
random.Random().randint(0, self._random_delay * 1000) * 0.001

View File

@ -16,14 +16,12 @@
import datetime
import json
import pkg_resources as pkg
import sys
import time
from unittest import mock
from oslo_config import cfg
from oslo_log import log as logging
from oslotest import base
import testtools.matchers as ttm
from mistral import context as auth_context
from mistral.db.sqlalchemy import base as db_sa_base
@ -133,18 +131,10 @@ class BaseTest(base.BaseTestCase):
self.assertIn(msg, e.message)
def assertListEqual(self, l1, l2):
if tuple(sys.version_info)[0:2] < (2, 7):
# for python 2.6 compatibility
self.assertEqual(l1, l2)
else:
super(BaseTest, self).assertListEqual(l1, l2)
super(BaseTest, self).assertListEqual(l1, l2)
def assertDictEqual(self, cmp1, cmp2):
if tuple(sys.version_info)[0:2] < (2, 7):
# for python 2.6 compatibility
self.assertThat(cmp1, ttm.Equals(cmp2))
else:
super(BaseTest, self).assertDictEqual(cmp1, cmp2)
super(BaseTest, self).assertDictEqual(cmp1, cmp2)
def _assert_single_item(self, items, **props):
return self._assert_multiple_items(items, 1, **props)[0]

View File

@ -61,7 +61,6 @@ def main(argv):
install = install_venv.InstallVenv(root, venv, pip_requires, test_requires,
py_version, project)
options = install.parse_args(argv)
install.check_python_version()
install.check_dependencies()
install.create_virtualenv(no_site_packages=options.no_site_packages)
install.install_dependencies()

View File

@ -44,10 +44,6 @@ class InstallVenv(object):
print(message % args, file=sys.stderr)
sys.exit(1)
def check_python_version(self):
if sys.version_info < (2, 6):
self.die("Need Python Version >= 2.6")
def run_command_with_code(self, cmd, redirect_output=True,
check_exit_code=True):
"""Runs a command in an out-of-process shell.