mirror of
https://github.com/adrienverge/yamllint.git
synced 2025-02-25 18:55:20 -06:00
End support for Python 2
As planned and advertized, yamllint drops support for Python 2 on 2021.
This commit is contained in:
parent
ee4d163ff8
commit
a3fc64d134
10
.travis.yml
10
.travis.yml
@ -2,7 +2,6 @@
|
|||||||
dist: xenial # required for Python >= 3.7 (travis-ci/travis-ci#9069)
|
dist: xenial # required for Python >= 3.7 (travis-ci/travis-ci#9069)
|
||||||
language: python
|
language: python
|
||||||
python:
|
python:
|
||||||
- 2.7
|
|
||||||
- 3.5
|
- 3.5
|
||||||
- 3.6
|
- 3.6
|
||||||
- 3.7
|
- 3.7
|
||||||
@ -13,17 +12,14 @@ env:
|
|||||||
- REMOVE_LOCALES=false
|
- REMOVE_LOCALES=false
|
||||||
- REMOVE_LOCALES=true
|
- REMOVE_LOCALES=true
|
||||||
install:
|
install:
|
||||||
- pip install pyyaml coveralls flake8 flake8-import-order doc8
|
- pip install pyyaml coveralls flake8 flake8-import-order doc8 sphinx
|
||||||
- if [[ $TRAVIS_PYTHON_VERSION != 2* ]]; then pip install sphinx; fi
|
|
||||||
- pip install .
|
- pip install .
|
||||||
- if [[ $REMOVE_LOCALES = "true" ]]; then sudo rm -rf /usr/lib/locale/*; fi
|
- if [[ $REMOVE_LOCALES = "true" ]]; then sudo rm -rf /usr/lib/locale/*; fi
|
||||||
script:
|
script:
|
||||||
- if [[ $TRAVIS_PYTHON_VERSION != nightly ]]; then flake8 .; fi
|
- if [[ $TRAVIS_PYTHON_VERSION != nightly ]]; then flake8 .; fi
|
||||||
- if [[ $TRAVIS_PYTHON_VERSION != 2* ]]; then doc8 $(git ls-files '*.rst'); fi
|
- doc8 $(git ls-files '*.rst')
|
||||||
- yamllint --strict $(git ls-files '*.yaml' '*.yml')
|
- yamllint --strict $(git ls-files '*.yaml' '*.yml')
|
||||||
- coverage run --source=yamllint -m unittest discover
|
- coverage run --source=yamllint -m unittest discover
|
||||||
- if [[ $TRAVIS_PYTHON_VERSION != 2* ]]; then
|
- python setup.py build_sphinx
|
||||||
python setup.py build_sphinx;
|
|
||||||
fi
|
|
||||||
after_success:
|
after_success:
|
||||||
coveralls
|
coveralls
|
||||||
|
@ -19,11 +19,7 @@ indentation, etc.
|
|||||||
:target: https://yamllint.readthedocs.io/en/latest/?badge=latest
|
:target: https://yamllint.readthedocs.io/en/latest/?badge=latest
|
||||||
:alt: Documentation status
|
:alt: Documentation status
|
||||||
|
|
||||||
Written in Python (compatible with Python 2 & 3).
|
Written in Python (compatible with Python 3 only).
|
||||||
|
|
||||||
⚠ Python 2 upstream support stopped on January 1, 2020. yamllint will keep
|
|
||||||
best-effort support for Python 2.7 until January 1, 2021. Past that date,
|
|
||||||
yamllint will drop all Python 2-related code.
|
|
||||||
|
|
||||||
Documentation
|
Documentation
|
||||||
-------------
|
-------------
|
||||||
|
@ -26,8 +26,6 @@ classifiers =
|
|||||||
Environment :: Console
|
Environment :: Console
|
||||||
Intended Audience :: Developers
|
Intended Audience :: Developers
|
||||||
License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
||||||
Programming Language :: Python :: 2
|
|
||||||
Programming Language :: Python :: 2.7
|
|
||||||
Programming Language :: Python :: 3
|
Programming Language :: Python :: 3
|
||||||
Programming Language :: Python :: 3.5
|
Programming Language :: Python :: 3.5
|
||||||
Programming Language :: Python :: 3.6
|
Programming Language :: Python :: 3.6
|
||||||
@ -48,7 +46,7 @@ project_urls =
|
|||||||
[options]
|
[options]
|
||||||
packages = find:
|
packages = find:
|
||||||
|
|
||||||
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
|
python_requires = >=3.5.*
|
||||||
|
|
||||||
include_package_data = True
|
include_package_data = True
|
||||||
install_requires =
|
install_requires =
|
||||||
|
@ -14,9 +14,6 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import sys
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
from tests.common import RuleTestCase
|
from tests.common import RuleTestCase
|
||||||
|
|
||||||
|
|
||||||
@ -159,7 +156,6 @@ class LineLengthTestCase(RuleTestCase):
|
|||||||
' {% this line is' + 99 * ' really' + ' long %}\n',
|
' {% this line is' + 99 * ' really' + ' long %}\n',
|
||||||
conf, problem=(3, 81))
|
conf, problem=(3, 81))
|
||||||
|
|
||||||
@unittest.skipIf(sys.version_info < (3, 0), 'Python 2 not supported')
|
|
||||||
def test_unicode(self):
|
def test_unicode(self):
|
||||||
conf = 'line-length: {max: 53}'
|
conf = 'line-length: {max: 53}'
|
||||||
self.check('---\n'
|
self.check('---\n'
|
||||||
|
@ -14,10 +14,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
try:
|
from io import StringIO
|
||||||
from cStringIO import StringIO
|
|
||||||
except ImportError:
|
|
||||||
from io import StringIO
|
|
||||||
import fcntl
|
import fcntl
|
||||||
import locale
|
import locale
|
||||||
import os
|
import os
|
||||||
@ -71,11 +68,6 @@ class CommandLineTestCase(unittest.TestCase):
|
|||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
super(CommandLineTestCase, cls).setUpClass()
|
super(CommandLineTestCase, cls).setUpClass()
|
||||||
|
|
||||||
# https://docs.python.org/3/library/unittest.html#deprecated-aliases
|
|
||||||
if sys.version_info < (3, 2):
|
|
||||||
cls.assertRegex = cls.assertRegexpMatches
|
|
||||||
cls.assertRaisesRegex = cls.assertRaisesRegexp
|
|
||||||
|
|
||||||
cls.wd = build_temp_workspace({
|
cls.wd = build_temp_workspace({
|
||||||
# .yaml file at root
|
# .yaml file at root
|
||||||
'a.yaml': '---\n'
|
'a.yaml': '---\n'
|
||||||
|
@ -14,10 +14,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
try:
|
from io import StringIO
|
||||||
from cStringIO import StringIO
|
|
||||||
except ImportError:
|
|
||||||
from io import StringIO
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
@ -31,15 +28,6 @@ from yamllint import config
|
|||||||
|
|
||||||
|
|
||||||
class SimpleConfigTestCase(unittest.TestCase):
|
class SimpleConfigTestCase(unittest.TestCase):
|
||||||
@classmethod
|
|
||||||
def setUpClass(cls):
|
|
||||||
super(SimpleConfigTestCase, cls).setUpClass()
|
|
||||||
|
|
||||||
# https://docs.python.org/3/library/unittest.html#deprecated-aliases
|
|
||||||
if sys.version_info < (3, 2):
|
|
||||||
cls.assertRegex = cls.assertRegexpMatches
|
|
||||||
cls.assertRaisesRegex = cls.assertRaisesRegexp
|
|
||||||
|
|
||||||
def test_parse_config(self):
|
def test_parse_config(self):
|
||||||
new = config.YamlLintConfig('rules:\n'
|
new = config.YamlLintConfig('rules:\n'
|
||||||
' colons:\n'
|
' colons:\n'
|
||||||
|
@ -26,15 +26,6 @@ PYTHON = sys.executable or 'python'
|
|||||||
|
|
||||||
|
|
||||||
class ModuleTestCase(unittest.TestCase):
|
class ModuleTestCase(unittest.TestCase):
|
||||||
@classmethod
|
|
||||||
def setUpClass(cls):
|
|
||||||
super(ModuleTestCase, cls).setUpClass()
|
|
||||||
|
|
||||||
# https://docs.python.org/3/library/unittest.html#deprecated-aliases
|
|
||||||
if sys.version_info < (3, 2):
|
|
||||||
cls.assertRegex = cls.assertRegexpMatches
|
|
||||||
cls.assertRaisesRegex = cls.assertRaisesRegexp
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.wd = tempfile.mkdtemp(prefix='yamllint-tests-')
|
self.wd = tempfile.mkdtemp(prefix='yamllint-tests-')
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ def run(input, conf, filepath=None):
|
|||||||
if conf.is_file_ignored(filepath):
|
if conf.is_file_ignored(filepath):
|
||||||
return ()
|
return ()
|
||||||
|
|
||||||
if isinstance(input, (type(b''), type(u''))): # compat with Python 2 & 3
|
if isinstance(input, (bytes, str)):
|
||||||
return _run(input, conf, filepath)
|
return _run(input, conf, filepath)
|
||||||
elif hasattr(input, 'read'): # Python 2's file or Python 3's io.IOBase
|
elif hasattr(input, 'read'): # Python 2's file or Python 3's io.IOBase
|
||||||
# We need to have everything in memory to parse correctly
|
# We need to have everything in memory to parse correctly
|
||||||
|
@ -17,10 +17,6 @@
|
|||||||
"""
|
"""
|
||||||
Use this rule to set a limit to lines length.
|
Use this rule to set a limit to lines length.
|
||||||
|
|
||||||
Note: with Python 2, the ``line-length`` rule may not work properly with
|
|
||||||
unicode characters because of the way strings are represented in bytes. We
|
|
||||||
recommend running yamllint with Python 3.
|
|
||||||
|
|
||||||
.. rubric:: Options
|
.. rubric:: Options
|
||||||
|
|
||||||
* ``max`` defines the maximal (inclusive) length of lines.
|
* ``max`` defines the maximal (inclusive) length of lines.
|
||||||
|
Loading…
Reference in New Issue
Block a user