Ver código fonte

drop python 3.4 support

minimum requirement is 3.5 now.

also: remove all references to python 3.4.
Thomas Waldmann 4 anos atrás
pai
commit
58c4289ac9

+ 0 - 4
.travis.yml

@@ -7,10 +7,6 @@ cache:
 matrix:
     fast_finish: true
     include:
-        - python: "3.4"
-          os: linux
-          dist: trusty
-          env: TOXENV=py34
         - python: "3.5.2"  # Use version 3.5.2 because it has lzma support while 3.5(.0) does not
           os: linux
           dist: trusty

+ 2 - 2
docs/development.rst

@@ -182,7 +182,7 @@ Some more advanced examples::
   # verify a changed tox.ini (run this after any change to tox.ini):
   fakeroot -u tox --recreate
 
-  fakeroot -u tox -e py34  # run all tests, but only on python 3.4
+  fakeroot -u tox -e py37  # run all tests, but only on python 3.7
 
   fakeroot -u tox borg.testsuite.locking  # only run 1 test module
 
@@ -321,7 +321,7 @@ Checklist:
 - Render ``CHANGES.rst`` via ``make html`` and check for markup errors.
 - Verify that ``MANIFEST.in`` and ``setup.py`` are complete.
 - ``python setup.py build_usage ; python setup.py build_man`` and
-  commit (be sure to build with Python 3.4 or 3.5 as Python 3.6 added `more
+  commit (be sure to build with Python 3.5 as Python 3.6 added `more
   guaranteed hashing algorithms
   <https://github.com/borgbackup/borg/issues/2123>`_).
 - Tag the release::

+ 3 - 3
docs/installation.rst

@@ -140,7 +140,7 @@ Dependencies
 To install |project_name| from a source package (including pip), you have to install the
 following dependencies first:
 
-* `Python 3`_ >= 3.4.0, plus development headers. Even though Python 3 is not
+* `Python 3`_ >= 3.5.0, plus development headers. Even though Python 3 is not
   the default Python version on most systems, it is usually available as an
   optional install.
 * OpenSSL_ >= 1.0.0, plus development headers.
@@ -237,7 +237,7 @@ and commands to make FUSE work for using the mount command.
 
      pkg install -y python3 openssl fusefs-libs pkgconf
      pkg install -y git
-     python3.4 -m ensurepip # to install pip for Python3
+     python3 -m ensurepip  # to install pip for Python3
      To use the mount command:
      echo 'fuse_load="YES"' >> /boot/loader.conf
      echo 'vfs.usermount=1' >> /etc/sysctl.conf
@@ -269,7 +269,7 @@ Use the Cygwin installer to install the dependencies::
 
 You can then install ``pip`` and ``virtualenv``::
 
-    easy_install-3.4 pip
+    easy_install-3.7 pip
     pip install virtualenv
 
 

+ 0 - 1
requirements.d/development.lock.txt

@@ -10,4 +10,3 @@ pytest-cov==2.6.1
 pytest-benchmark==3.2.2
 Cython==0.29.6
 twine==1.13.0
-readme-renderer<25.0

+ 0 - 1
requirements.d/development.txt

@@ -11,4 +11,3 @@ pytest-cov
 pytest-benchmark
 Cython!=0.27
 twine
-readme-renderer<25.0

+ 1 - 2
setup.py

@@ -23,7 +23,7 @@ prefer_system_libb2 = True
 
 # prefer_system_msgpack is another option, but you need to set it in src/borg/helpers.py.
 
-min_python = (3, 4)
+min_python = (3, 5)
 my_python = sys.version_info
 
 if my_python < min_python:
@@ -857,7 +857,6 @@ setup(
         'Operating System :: POSIX :: Linux',
         'Programming Language :: Python',
         'Programming Language :: Python :: 3',
-        'Programming Language :: Python :: 3.4',
         'Programming Language :: Python :: 3.5',
         'Programming Language :: Python :: 3.6',
         'Programming Language :: Python :: 3.7',

+ 2 - 2
src/borg/archiver.py

@@ -2390,11 +2390,11 @@ class Archiver:
 
         {now}
             The current local date and time, by default in ISO-8601 format.
-            You can also supply your own `format string <https://docs.python.org/3.4/library/datetime.html#strftime-and-strptime-behavior>`_, e.g. {now:%Y-%m-%d_%H:%M:%S}
+            You can also supply your own `format string <https://docs.python.org/3.7/library/datetime.html#strftime-and-strptime-behavior>`_, e.g. {now:%Y-%m-%d_%H:%M:%S}
 
         {utcnow}
             The current UTC date and time, by default in ISO-8601 format.
-            You can also supply your own `format string <https://docs.python.org/3.4/library/datetime.html#strftime-and-strptime-behavior>`_, e.g. {utcnow:%Y-%m-%d_%H:%M:%S}
+            You can also supply your own `format string <https://docs.python.org/3.7/library/datetime.html#strftime-and-strptime-behavior>`_, e.g. {utcnow:%Y-%m-%d_%H:%M:%S}
 
         {user}
             The user name (or UID, if no name is available) of the user running borg.

+ 1 - 62
src/borg/helpers.py

@@ -28,6 +28,7 @@ from datetime import datetime, timezone, timedelta
 from functools import partial, lru_cache
 from itertools import islice
 from operator import attrgetter
+from os import scandir
 from string import Formatter
 from shutil import get_terminal_size
 
@@ -2134,68 +2135,6 @@ def consume(iterator, n=None):
         # advance to the empty slice starting at position n
         next(islice(iterator, n, n), None)
 
-# GenericDirEntry, scandir_generic (c) 2012 Ben Hoyt
-# from the python-scandir package (3-clause BSD license, just like us, so no troubles here)
-# note: simplified version
-
-
-class GenericDirEntry:
-    __slots__ = ('name', '_scandir_path', '_path')
-
-    def __init__(self, scandir_path, name):
-        self._scandir_path = scandir_path
-        self.name = name
-        self._path = None
-
-    @property
-    def path(self):
-        if self._path is None:
-            self._path = os.path.join(self._scandir_path, self.name)
-        return self._path
-
-    def stat(self, follow_symlinks=True):
-        assert not follow_symlinks
-        return os.stat(self.path, follow_symlinks=follow_symlinks)
-
-    def _check_type(self, type):
-        st = self.stat(False)
-        return stat.S_IFMT(st.st_mode) == type
-
-    def is_dir(self, follow_symlinks=True):
-        assert not follow_symlinks
-        return self._check_type(stat.S_IFDIR)
-
-    def is_file(self, follow_symlinks=True):
-        assert not follow_symlinks
-        return self._check_type(stat.S_IFREG)
-
-    def is_symlink(self):
-        return self._check_type(stat.S_IFLNK)
-
-    def inode(self):
-        st = self.stat(False)
-        return st.st_ino
-
-    def __repr__(self):
-        return '<{0}: {1!r}>'.format(self.__class__.__name__, self.path)
-
-
-def scandir_generic(path='.'):
-    """Like os.listdir(), but yield DirEntry objects instead of returning a list of names."""
-    for name in os.listdir(path):
-        yield GenericDirEntry(path, name)
-
-
-try:
-    from os import scandir
-except ImportError:
-    try:
-        # Try python-scandir on Python 3.4
-        from scandir import scandir
-    except ImportError:
-        # If python-scandir is not installed, then use a version that is just as slow as listdir.
-        scandir = scandir_generic
-
 
 def scandir_keyfunc(dirent):
     try:

+ 3 - 6
src/borg/testsuite/archiver.py

@@ -61,8 +61,6 @@ from .platform import fakeroot_detected
 from .upgrader import make_attic_repo
 from . import key
 
-# 3.4.3 == first version with argparse bugfix for nargs='*' and 0 arguments given
-argparse_nargs0_fixed = sys.version_info >= (3, 4, 3)
 
 src_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
 
@@ -1053,10 +1051,9 @@ class ArchiverTestCase(ArchiverTestCaseBase):
         self.cmd('init', '--encryption=repokey', self.repository_location)
         self.create_regular_file('file1', size=1024 * 80)
         self.create_regular_file('file2', size=1024 * 80)
-        if argparse_nargs0_fixed:
-            output = self.cmd('create', '-v', '--list', '--pattern=R input', self.repository_location + '::test')
-            self.assert_in("A input/file1", output)
-            self.assert_in("A input/file2", output)
+        output = self.cmd('create', '-v', '--list', '--pattern=R input', self.repository_location + '::test')
+        self.assert_in("A input/file1", output)
+        self.assert_in("A input/file2", output)
 
     def test_create_pattern(self):
         """test file patterns during create"""

+ 1 - 1
tox.ini

@@ -2,7 +2,7 @@
 # fakeroot -u tox --recreate
 
 [tox]
-envlist = py{34,35,36,37,38,39},flake8
+envlist = py{35,36,37,38,39},flake8
 
 [testenv]
 deps =