From 929f3e1e1b664ed8cdef90a40c96804edfd08d59 Mon Sep 17 00:00:00 2001 From: Hugo Date: Sun, 18 Mar 2018 12:06:10 +0200 Subject: Drop support for EOL Python 2.6 --- .appveyor.yml | 3 --- .travis.yml | 3 --- README.md | 6 +----- doc/source/intro.rst | 10 +--------- git/cmd.py | 5 ++--- git/config.py | 2 +- git/objects/submodule/base.py | 5 +---- git/odict.py | 10 ---------- git/test/lib/helper.py | 7 +------ git/test/test_base.py | 5 +---- git/test/test_fun.py | 6 +----- git/test/test_index.py | 13 ++----------- git/test/test_remote.py | 5 +---- git/test/test_repo.py | 11 +---------- git/test/test_submodule.py | 5 +---- git/test/test_tree.py | 5 +---- git/test/test_util.py | 5 +---- git/util.py | 5 +---- requirements.txt | 1 - setup.py | 24 +----------------------- test-requirements.txt | 2 +- tox.ini | 2 +- 22 files changed, 20 insertions(+), 120 deletions(-) delete mode 100644 git/odict.py diff --git a/.appveyor.yml b/.appveyor.yml index 5a96f878..8eeca501 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -7,9 +7,6 @@ environment: matrix: ## MINGW # - - PYTHON: "C:\\Python26" - PYTHON_VERSION: "2.6" - GIT_PATH: "%GIT_DAEMON_PATH%" - PYTHON: "C:\\Python27" PYTHON_VERSION: "2.7" GIT_PATH: "%GIT_DAEMON_PATH%" diff --git a/.travis.yml b/.travis.yml index f20e76ae..524b8013 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: python python: - - "2.6" - "2.7" - "3.3" - "3.4" @@ -12,7 +11,6 @@ python: # - "pypy" - won't work as smmap doesn't work (see gitdb/.travis.yml for details) matrix: allow_failures: - - python: "2.6" - python: "3.6-dev" - python: "3.7-dev" - python: "nightly" @@ -26,7 +24,6 @@ install: - git fetch --tags - pip install -r test-requirements.txt - pip install codecov sphinx - - if [ "$TRAVIS_PYTHON_VERSION" == '2.6' ]; then pip install unittest2; fi # generate some reflog as git-python tests need it (in master) - ./init-tests-after-clone.sh diff --git a/README.md b/README.md index 33b2028e..8e9d2126 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ If it is not in your `PATH`, you can help GitPython find it by setting the `GIT_PYTHON_GIT_EXECUTABLE=` environment variable. * Git (1.7.x or newer) -* Python 2.7 to 3.6, while python 2.6 is supported on a *best-effort basis*. +* Python 2.7 to 3.6. The list of dependencies are listed in `./requirements.txt` and `./test-requirements.txt`. The installer takes care of installing them for you. @@ -68,10 +68,6 @@ For *Windows*, we do regularly test it on [Appveyor CI](https://www.appveyor.com but not all test-cases pass - you may help improve them by exploring [Issue #525](https://github.com/gitpython-developers/GitPython/issues/525). -#### Python 2.6 - -Python 2.6 is supported on best-effort basis; which means that it is likely to deteriorate over time. - ### RUNNING TESTS *Important*: Right after cloning this repository, please be sure to have executed diff --git a/doc/source/intro.rst b/doc/source/intro.rst index bfc5a778..48f898b2 100644 --- a/doc/source/intro.rst +++ b/doc/source/intro.rst @@ -14,8 +14,6 @@ Requirements ============ * `Python`_ 2.7 or newer - Since GitPython 2.0.0. Please note that python 2.6 is still reasonably well supported, but might - deteriorate over time. Support is provided on a best-effort basis only. * `Git`_ 1.7.0 or newer It should also work with older versions, but it may be that some operations involving remotes will not work as expected. @@ -75,12 +73,6 @@ codebase for `__del__` implementations and call these yourself when you see fit. Another way assure proper cleanup of resources is to factor out GitPython into a separate process which can be dropped periodically. -Best-effort for Python 2.6 and Windows support ----------------------------------------------- - -This means that support for these platforms is likely to worsen over time -as they are kept alive solely by their users, or not. - Getting Started =============== @@ -124,7 +116,7 @@ http://stackoverflow.com/questions/tagged/gitpython Issue Tracker ============= -The issue tracker is hosted by github: +The issue tracker is hosted by GitHub: https://github.com/gitpython-developers/GitPython/issues diff --git a/git/cmd.py b/git/cmd.py index 13c01401..6b492f11 100644 --- a/git/cmd.py +++ b/git/cmd.py @@ -17,6 +17,7 @@ from subprocess import ( import subprocess import sys import threading +from collections import OrderedDict from textwrap import dedent from git.compat import ( @@ -31,7 +32,6 @@ from git.compat import ( is_win, ) from git.exc import CommandError -from git.odict import OrderedDict from git.util import is_cygwin_git, cygpath, expand_path from .exc import ( @@ -143,8 +143,7 @@ CREATE_NO_WINDOW = 0x08000000 ## CREATE_NEW_PROCESS_GROUP is needed to allow killing it afterwards, # see https://docs.python.org/3/library/subprocess.html#subprocess.Popen.send_signal PROC_CREATIONFLAGS = (CREATE_NO_WINDOW | subprocess.CREATE_NEW_PROCESS_GROUP - if is_win and sys.version_info >= (2, 7) - else 0) + if is_win else 0) class Git(LazyMixin): diff --git a/git/config.py b/git/config.py index 3310db89..68d65ae9 100644 --- a/git/config.py +++ b/git/config.py @@ -12,6 +12,7 @@ import inspect import logging import os import re +from collections import OrderedDict from git.compat import ( string_types, @@ -21,7 +22,6 @@ from git.compat import ( with_metaclass, PY3 ) -from git.odict import OrderedDict from git.util import LockFile import os.path as osp diff --git a/git/objects/submodule/base.py b/git/objects/submodule/base.py index 33151217..b53ce3ec 100644 --- a/git/objects/submodule/base.py +++ b/git/objects/submodule/base.py @@ -3,10 +3,7 @@ from io import BytesIO import logging import os import stat -try: - from unittest import SkipTest -except ImportError: - from unittest2 import SkipTest +from unittest import SkipTest import uuid import git diff --git a/git/odict.py b/git/odict.py deleted file mode 100644 index f003d14e..00000000 --- a/git/odict.py +++ /dev/null @@ -1,10 +0,0 @@ -try: - from collections import OrderedDict -except ImportError: - try: - from ordereddict import OrderedDict - except ImportError: - import warnings - warnings.warn("git-python needs the ordereddict module installed in python below 2.6 and below.") - warnings.warn("Using standard dictionary as substitute, and cause reordering when writing git config") - OrderedDict = dict diff --git a/git/test/lib/helper.py b/git/test/lib/helper.py index cb46173d..1c06010f 100644 --- a/git/test/lib/helper.py +++ b/git/test/lib/helper.py @@ -15,6 +15,7 @@ import sys import tempfile import textwrap import time +import unittest from git.compat import string_types, is_win from git.util import rmtree, cwd @@ -23,11 +24,6 @@ import gitdb import os.path as osp -if sys.version_info[0:2] == (2, 6): - import unittest2 as unittest -else: - import unittest - TestCase = unittest.TestCase SkipTest = unittest.SkipTest skipIf = unittest.skipIf @@ -348,7 +344,6 @@ class TestBase(TestCase): of the project history ( to assure tests don't fail for others ). """ - # On py26, unittest2 has assertRaisesRegex # On py3, unittest has assertRaisesRegex # On py27, we use unittest, which names it differently: if sys.version_info[0:2] == (2, 7): diff --git a/git/test/test_base.py b/git/test/test_base.py index 69f161be..2132806b 100644 --- a/git/test/test_base.py +++ b/git/test/test_base.py @@ -7,10 +7,7 @@ import os import sys import tempfile -try: - from unittest import SkipTest, skipIf -except ImportError: - from unittest2 import SkipTest, skipIf +from unittest import SkipTest, skipIf from git import ( Blob, diff --git a/git/test/test_fun.py b/git/test/test_fun.py index 5e32a1f9..d5e6e50d 100644 --- a/git/test/test_fun.py +++ b/git/test/test_fun.py @@ -2,11 +2,7 @@ from io import BytesIO from stat import S_IFDIR, S_IFREG, S_IFLNK from os import stat import os.path as osp - -try: - from unittest import skipIf, SkipTest -except ImportError: - from unittest2 import skipIf, SkipTest +from unittest import skipIf, SkipTest from git import Git from git.compat import PY3 diff --git a/git/test/test_index.py b/git/test/test_index.py index 757bec9f..73123d6b 100644 --- a/git/test/test_index.py +++ b/git/test/test_index.py @@ -11,12 +11,8 @@ from stat import ( S_ISLNK, ST_MODE ) -import sys import tempfile -try: - from unittest import skipIf -except ImportError: - from unittest2 import skipIf +from unittest import skipIf from git import ( IndexFile, @@ -168,9 +164,7 @@ class TestIndex(TestBase): except Exception as ex: msg_py3 = "required argument is not an integer" msg_py2 = "cannot convert argument to integer" - msg_py26 = "unsupported operand type(s) for &: 'str' and 'long'" - assert msg_py2 in str(ex) or msg_py3 in str(ex) or \ - msg_py26 in str(ex), str(ex) + assert msg_py2 in str(ex) or msg_py3 in str(ex) ## 2nd time should not fail due to stray lock file try: @@ -180,9 +174,6 @@ class TestIndex(TestBase): @with_rw_repo('0.1.6') def test_index_file_from_tree(self, rw_repo): - if sys.version_info < (2, 7): - ## Skipped, not `assertRaisesRegexp` in py2.6 - return common_ancestor_sha = "5117c9c8a4d3af19a9958677e45cda9269de1541" cur_sha = "4b43ca7ff72d5f535134241e7c797ddc9c7a3573" other_sha = "39f85c4358b7346fee22169da9cad93901ea9eb9" diff --git a/git/test/test_remote.py b/git/test/test_remote.py index ad9210f6..35924ca2 100644 --- a/git/test/test_remote.py +++ b/git/test/test_remote.py @@ -6,10 +6,7 @@ import random import tempfile -try: - from unittest import skipIf -except ImportError: - from unittest2 import skipIf +from unittest import skipIf from git import ( RemoteProgress, diff --git a/git/test/test_repo.py b/git/test/test_repo.py index 2c3ad957..6985f254 100644 --- a/git/test/test_repo.py +++ b/git/test/test_repo.py @@ -9,12 +9,8 @@ from io import BytesIO import itertools import os import pickle -import sys import tempfile -try: - from unittest import skipIf, SkipTest -except ImportError: - from unittest2 import skipIf, SkipTest +from unittest import skipIf, SkipTest try: import pathlib @@ -364,9 +360,6 @@ class TestRepo(TestBase): @patch.object(Git, '_call_process') def test_should_display_blame_information(self, git): - if sys.version_info < (2, 7): - ## Skipped, not `assertRaisesRegexp` in py2.6 - return git.return_value = fixture('blame') b = self.rorepo.blame('master', 'lib/git.py') assert_equal(13, len(b)) @@ -792,8 +785,6 @@ class TestRepo(TestBase): def test_repo_odbtype(self): target_type = GitCmdObjectDB - if sys.version_info[:2] < (2, 5): - target_type = GitCmdObjectDB self.assertIsInstance(self.rorepo.odb, target_type) def test_submodules(self): diff --git a/git/test/test_submodule.py b/git/test/test_submodule.py index 5c8a2798..3b15c095 100644 --- a/git/test/test_submodule.py +++ b/git/test/test_submodule.py @@ -3,10 +3,7 @@ # the BSD License: http://www.opensource.org/licenses/bsd-license.php import os import sys -try: - from unittest import skipIf -except ImportError: - from unittest2 import skipIf +from unittest import skipIf import git from git.cmd import Git diff --git a/git/test/test_tree.py b/git/test/test_tree.py index 5fd4d760..f3376e23 100644 --- a/git/test/test_tree.py +++ b/git/test/test_tree.py @@ -6,10 +6,7 @@ from io import BytesIO import sys -try: - from unittest import skipIf -except ImportError: - from unittest2 import skipIf +from unittest import skipIf from git import ( Tree, diff --git a/git/test/test_util.py b/git/test/test_util.py index d30c8376..b7925c84 100644 --- a/git/test/test_util.py +++ b/git/test/test_util.py @@ -6,10 +6,7 @@ import tempfile import time -try: - from unittest import skipIf -except ImportError: - from unittest2 import skipIf +from unittest import skipIf import ddt diff --git a/git/util.py b/git/util.py index 52029fed..688ead39 100644 --- a/git/util.py +++ b/git/util.py @@ -14,10 +14,7 @@ import re import shutil import stat import time -try: - from unittest import SkipTest -except ImportError: - from unittest2 import SkipTest +from unittest import SkipTest from gitdb.util import (# NOQA @IgnorePep8 make_sha, diff --git a/requirements.txt b/requirements.txt index a8e7a7a8..39644606 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ gitdb>=0.6.4 ddt>=1.1.1 -unittest2; python_version < '2.7' diff --git a/setup.py b/setup.py index 47523e03..e0641824 100755 --- a/setup.py +++ b/setup.py @@ -9,8 +9,6 @@ except ImportError: from distutils.command.build_py import build_py as _build_py from setuptools.command.sdist import sdist as _sdist -import pkg_resources -import logging import os import sys from os import path @@ -66,26 +64,7 @@ def _stamp_version(filename): install_requires = ['gitdb2 >= 2.0.0'] -extras_require = { - ':python_version == "2.6"': ['ordereddict'], -} test_requires = ['ddt>=1.1.1'] -if sys.version_info[:2] < (2, 7): - test_requires.append('mock') - -try: - if 'bdist_wheel' not in sys.argv: - for key, value in extras_require.items(): - if key.startswith(':') and pkg_resources.evaluate_marker(key[1:]): - install_requires.extend(value) -except Exception: - logging.getLogger(__name__).exception( - 'Something went wrong calculating platform specific dependencies, so ' - "you're getting them all!" - ) - for key, value in extras_require.items(): - if key.startswith(':'): - install_requires.extend(value) # end setup( @@ -101,7 +80,7 @@ setup( package_data={'git.test': ['fixtures/*']}, package_dir={'git': 'git'}, license="BSD License", - python_requires='>=2.6, !=3.0.*, !=3.1.*, !=3.2.*', + python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*', requires=['gitdb2 (>=2.0.0)'], install_requires=install_requires, test_requirements=test_requires + install_requires, @@ -126,7 +105,6 @@ setup( "Operating System :: MacOS :: MacOS X", "Programming Language :: Python", "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", diff --git a/test-requirements.txt b/test-requirements.txt index 8f13395d..1cea3aa2 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -3,4 +3,4 @@ coverage flake8 nose -mock; python_version<='2.7' +mock; python_version=='2.7' \ No newline at end of file diff --git a/tox.ini b/tox.ini index 9f03872b..21e91c7d 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py26,py27,py33,py34,py35,flake8 +envlist = py27,py33,py34,py35,py36,flake8 [testenv] commands = nosetests {posargs} -- cgit v1.2.1