From 281fd591e7bf2d106a5b2586684542a27bac2c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Beraud?= Date: Tue, 4 Feb 2020 16:17:47 +0100 Subject: [PATCH] [ussuri][goal] Drop python 2.7 support and testing OpenStack is dropping the py2.7 support in Ussuri cycle. Complete discussion & schedule can be found in - http://lists.openstack.org/pipermail/openstack-discuss/2019-October/010142.html - https://etherpad.openstack.org/p/drop-python2-support Ussuri Communtiy-wide goal: https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html Change-Id: I340a7909c49e7d2a8c82c668cbdaf9ced7196f67 Sem-Ver: api-break --- .zuul.yaml | 4 +- doc/requirements.txt | 3 +- oslo_i18n/tests/test_factory.py | 39 ------------------- ...rop-python27-support-eb9c2ad3268f0c1f.yaml | 5 +++ setup.cfg | 9 ++--- setup.py | 8 ---- tox.ini | 6 +-- 7 files changed, 14 insertions(+), 60 deletions(-) create mode 100644 releasenotes/notes/drop-python27-support-eb9c2ad3268f0c1f.yaml diff --git a/.zuul.yaml b/.zuul.yaml index 9bb6ef1..b0af3fe 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,12 +1,10 @@ - project: templates: - check-requirements - - lib-forward-testing - lib-forward-testing-python3 - openstack-cover-jobs - openstack-lower-constraints-jobs - - openstack-python-jobs - - openstack-python3-train-jobs + - openstack-python3-ussuri-jobs - periodic-stable-jobs - publish-openstack-docs-pti - release-notes-jobs-python3 diff --git a/doc/requirements.txt b/doc/requirements.txt index 1b0cdda..970a9d3 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -2,8 +2,7 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -sphinx>=1.8.0,<2.0.0;python_version=='2.7' # BSD -sphinx>=1.8.0,!=2.1.0;python_version>='3.4' # BSD +sphinx>=1.8.0,!=2.1.0 # BSD openstackdocstheme>=1.18.1 # Apache-2.0 reno>=2.5.0 # Apache-2.0 sphinxcontrib-apidoc>=0.2.0 # BSD diff --git a/oslo_i18n/tests/test_factory.py b/oslo_i18n/tests/test_factory.py index 6bbe684..d99625d 100644 --- a/oslo_i18n/tests/test_factory.py +++ b/oslo_i18n/tests/test_factory.py @@ -61,18 +61,6 @@ class TranslatorFactoryTest(test_base.BaseTestCase): r = tf.primary('some text') self.assertNotIsInstance(r, _message.Message) - def test_py2(self): - _lazy.enable_lazy(False) - with mock.patch.object(six, 'PY3', False): - with mock.patch('gettext.translation') as translation: - trans = mock.Mock() - translation.return_value = trans - trans.gettext.side_effect = AssertionError( - 'should have called ugettext') - tf = _factory.TranslatorFactory('domain') - tf.primary('some text') - trans.ugettext.assert_called_with('some text') - def test_py3(self): _lazy.enable_lazy(False) with mock.patch.object(six, 'PY3', True): @@ -92,20 +80,6 @@ class TranslatorFactoryTest(test_base.BaseTestCase): tf._make_log_translation_func('mylevel') mtf.assert_called_with('domain-log-mylevel') - def test_contextual_form_py2(self): - _lazy.enable_lazy(False) - with mock.patch.object(six, 'PY3', False): - with mock.patch('gettext.translation') as translation: - trans = mock.Mock() - translation.return_value = trans - trans.gettext.side_effect = AssertionError( - 'should have called ugettext') - trans.ugettext.return_value = "some text" - tf = _factory.TranslatorFactory('domain') - tf.contextual_form('context', 'some text') - trans.ugettext.assert_called_with( - "%s%s%s" % ('context', CONTEXT_SEPARATOR, 'some text')) - def test_contextual_form_py3(self): _lazy.enable_lazy(False) with mock.patch.object(six, 'PY3', True): @@ -120,19 +94,6 @@ class TranslatorFactoryTest(test_base.BaseTestCase): trans.gettext.assert_called_with( "%s%s%s" % ('context', CONTEXT_SEPARATOR, 'some text')) - def test_plural_form_py2(self): - _lazy.enable_lazy(False) - with mock.patch.object(six, 'PY3', False): - with mock.patch('gettext.translation') as translation: - trans = mock.Mock() - translation.return_value = trans - trans.ngettext.side_effect = AssertionError( - 'should have called ungettext') - tf = _factory.TranslatorFactory('domain') - tf.plural_form('single', 'plural', 1) - trans.ungettext.assert_called_with( - 'single', 'plural', 1) - def test_plural_form_py3(self): _lazy.enable_lazy(False) with mock.patch.object(six, 'PY3', True): diff --git a/releasenotes/notes/drop-python27-support-eb9c2ad3268f0c1f.yaml b/releasenotes/notes/drop-python27-support-eb9c2ad3268f0c1f.yaml new file mode 100644 index 0000000..5684dbe --- /dev/null +++ b/releasenotes/notes/drop-python27-support-eb9c2ad3268f0c1f.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - | + Support for Python 2.7 has been dropped. The minimum version of Python now + supported is Python 3.6. diff --git a/setup.cfg b/setup.cfg index 562b2a3..e331c7b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,6 +6,7 @@ description-file = author = OpenStack author-email = openstack-discuss@lists.openstack.org home-page = https://docs.openstack.org/oslo.i18n/latest +python-requires = >=3.6 classifier = Environment :: OpenStack Intended Audience :: Information Technology @@ -13,11 +14,12 @@ classifier = License :: OSI Approved :: Apache Software License Operating System :: POSIX :: Linux Programming Language :: Python - Programming Language :: Python :: 2 - Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3 :: Only + Programming Language :: Python :: Implementation :: CPython + [files] packages = @@ -36,6 +38,3 @@ input_file = oslo_i18n/locale/oslo_i18n.pot keywords = _ gettext ngettext l_ lazy_gettext _C:1c,2 _P:1,2 mapping_file = babel.cfg output_file = oslo_i18n/locale/oslo_i18n.pot - -[bdist_wheel] -universal = 1 diff --git a/setup.py b/setup.py index 566d844..f63cc23 100644 --- a/setup.py +++ b/setup.py @@ -16,14 +16,6 @@ # THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT import setuptools -# In python < 2.7.4, a lazy loading of package `pbr` will break -# setuptools if some other modules registered functions in `atexit`. -# solution from: http://bugs.python.org/issue15881#msg170215 -try: - import multiprocessing # noqa -except ImportError: - pass - setuptools.setup( setup_requires=['pbr>=2.0.0'], pbr=True) diff --git a/tox.ini b/tox.ini index b9958ff..3bbe0a1 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] -minversion = 3.1 -envlist = py27,py37,pep8 -ignore_basepython_conflict = True +minversion = 3.1.1 +envlist = py37,pep8 +ignore_basepython_conflict = true [testenv] basepython = python3