From dac619e4917b0ad43d836a534633d68a871aecca Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 20 Jul 2019 17:26:16 +0800 Subject: [PATCH] Drop python 2.7 support and help with encodings Fixes #312 --- .travis.yml | 1 - README.md | 2 +- doc/source/intro.rst | 2 +- git/compat.py | 5 ++++- git/repo/base.py | 1 + requirements.txt | 2 ++ setup.py | 4 +--- 7 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index aed714afd..7939e161b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: python python: - - "2.7" - "3.4" - "3.5" - "3.6" diff --git a/README.md b/README.md index e252c34c9..3734019ec 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.7. +* Python 3 to 3.7. The list of dependencies are listed in `./requirements.txt` and `./test-requirements.txt`. The installer takes care of installing them for you. diff --git a/doc/source/intro.rst b/doc/source/intro.rst index d68e5eb22..e2cd196b8 100644 --- a/doc/source/intro.rst +++ b/doc/source/intro.rst @@ -13,7 +13,7 @@ The object database implementation is optimized for handling large quantities of Requirements ============ -* `Python`_ 2.7 or newer +* `Python`_ 3.0 or newer * `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. diff --git a/git/compat.py b/git/compat.py index b63768f3d..02dc69de8 100644 --- a/git/compat.py +++ b/git/compat.py @@ -30,7 +30,10 @@ is_win = (os.name == 'nt') is_posix = (os.name == 'posix') is_darwin = (os.name == 'darwin') -defenc = sys.getdefaultencoding() +if hasattr(sys, 'getfilesystemencoding'): + defenc = sys.getfilesystemencoding() +if defenc is None: + defenc = sys.getdefaultencoding() if PY3: import io diff --git a/git/repo/base.py b/git/repo/base.py index f35870803..911494ad6 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -4,6 +4,7 @@ # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php +from builtins import str from collections import namedtuple import logging import os diff --git a/requirements.txt b/requirements.txt index 63d5ddfe7..c0cca9f49 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,3 @@ gitdb2 (>=2.0.0) +gitdb>=0.6.4 +ddt>=1.1.1 diff --git a/setup.py b/setup.py index 49288f697..65656d555 100755 --- a/setup.py +++ b/setup.py @@ -79,7 +79,7 @@ def _stamp_version(filename): package_data={'git.test': ['fixtures/*']}, package_dir={'git': 'git'}, license="BSD License", - python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', + python_requires='>=3.0, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', install_requires=requirements, tests_require=requirements + test_requirements, zip_safe=False, @@ -102,8 +102,6 @@ def _stamp_version(filename): "Operating System :: Microsoft :: Windows", "Operating System :: MacOS :: MacOS X", "Programming Language :: Python", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5",