Removed Python2 support

Closes: #6890

Signed-off-by: Bastian Venthur <bastian.venthur@flixbus.com>
This commit is contained in:
Bastian Venthur 2019-11-19 14:47:57 +01:00
parent eab3aab9be
commit e8424d5ae0
80 changed files with 18 additions and 378 deletions

View File

@ -17,9 +17,6 @@
sha: v1.3.4
hooks:
- id: reorder-python-imports
language_version: 'python2.7'
language_version: 'python3.7'
args:
- --add-import
- from __future__ import absolute_import
- --add-import
- from __future__ import unicode_literals
- --py3-plus

View File

@ -24,8 +24,6 @@ RUN apk add --no-cache \
musl-dev \
openssl \
openssl-dev \
python2 \
python2-dev \
zlib-dev
ENV BUILD_BOOTLOADER=1
@ -40,7 +38,6 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
libssl-dev \
make \
openssl \
python2.7-dev \
zlib1g-dev
FROM build-${BUILD_PLATFORM} AS build

View File

@ -1,6 +1,3 @@
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import unicode_literals
from compose.cli.main import main
main()

View File

@ -1,4 +1,2 @@
from __future__ import absolute_import
from __future__ import unicode_literals
__version__ = '1.26.0dev'

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
from compose.cli.main import main
main()

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
from ..const import IS_WINDOWS_PLATFORM
NAMES = [

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import logging
import os
import re

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import logging
import os.path
import ssl

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
from inspect import getdoc
from docopt import docopt

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import contextlib
import logging
import socket

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import logging
import shutil

View File

@ -1,15 +1,12 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import _thread as thread
import sys
from collections import namedtuple
from itertools import cycle
from queue import Empty
from queue import Queue
from threading import Thread
from docker.errors import APIError
from six.moves import _thread as thread
from six.moves.queue import Empty
from six.moves.queue import Queue
from . import colors
from compose import utils

View File

@ -1,7 +1,3 @@
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import contextlib
import functools
import json

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import signal
from ..const import IS_WINDOWS_PLATFORM

View File

@ -1,7 +1,3 @@
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import math
import os
import platform

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import functools
import logging
import pprint

View File

@ -1,7 +1,4 @@
# flake8: noqa
from __future__ import absolute_import
from __future__ import unicode_literals
from . import environment
from .config import ConfigurationError
from .config import DOCKER_CONFIG_KEYS

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import functools
import io
import logging

View File

@ -1,6 +1,5 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import codecs
import contextlib
import logging
import os
import re

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
VERSION_EXPLANATION = (

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import logging
import re
from string import Template

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import six
import yaml

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
from compose.config.errors import DependencyError

View File

@ -1,9 +1,6 @@
"""
Types for objects parsed from the configuration.
"""
from __future__ import absolute_import
from __future__ import unicode_literals
import json
import ntpath
import os

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import json
import logging
import os

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import sys
from .version import ComposeVersion

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
from functools import reduce
import six

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
class OperationFailedError(Exception):

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import logging
import re
from collections import OrderedDict

View File

@ -1,18 +1,15 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import _thread as thread
import logging
import operator
import sys
from queue import Empty
from queue import Queue
from threading import Lock
from threading import Semaphore
from threading import Thread
from docker.errors import APIError
from docker.errors import ImageNotFound
from six.moves import _thread as thread
from six.moves.queue import Empty
from six.moves.queue import Queue
from compose.cli.colors import green
from compose.cli.colors import red

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
from compose import utils

View File

@ -1,14 +1,11 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import datetime
import enum
import logging
import operator
import re
from functools import reduce
from os import path
import enum
import six
from docker.errors import APIError
from docker.errors import ImageNotFound

View File

@ -1,6 +1,4 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import enum
import itertools
import json
import logging
@ -12,7 +10,6 @@ from collections import namedtuple
from collections import OrderedDict
from operator import attrgetter
import enum
import six
from docker.errors import APIError
from docker.errors import ImageNotFound

View File

@ -31,9 +31,6 @@ https://golang.org/pkg/time/#ParseDuration
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from __future__ import absolute_import
from __future__ import unicode_literals
import re
HOURS = r'(?P<hours>[\d.]+)h'

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import codecs
import hashlib
import json.decoder

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
from distutils.version import LooseVersion

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import logging
import re

View File

@ -3,9 +3,6 @@
Migrate a Compose file from the V1 format in Compose 1.5 to the V2 format
supported by Compose 1.6+
"""
from __future__ import absolute_import
from __future__ import unicode_literals
import argparse
import logging
import sys

View File

@ -1,5 +1,4 @@
backports.shutil_get_terminal_size==1.0.0
backports.ssl-match-hostname==3.5.0.1; python_version < '3'
cached-property==1.5.1
certifi==2020.4.5.1
chardet==3.0.4

View File

@ -1,126 +0,0 @@
#!/usr/bin/env python3
from __future__ import absolute_import
from __future__ import unicode_literals
import re
import click
from git import Repo
from utils import update_init_py_version
from utils import update_run_sh_version
from utils import yesno
VALID_VERSION_PATTERN = re.compile(r"^\d+\.\d+\.\d+(-rc\d+)?$")
class Version(str):
def matching_groups(self):
match = VALID_VERSION_PATTERN.match(self)
if not match:
return False
return match.groups()
def is_ga_version(self):
groups = self.matching_groups()
if not groups:
return False
rc_suffix = groups[1]
return not rc_suffix
def validate(self):
return len(self.matching_groups()) > 0
def branch_name(self):
if not self.validate():
return None
rc_part = self.matching_groups()[0]
ver = self
if rc_part:
ver = ver[:-len(rc_part)]
tokens = ver.split(".")
tokens[-1] = 'x'
return ".".join(tokens)
def create_bump_commit(repository, version):
print('Creating bump commit...')
repository.commit('-a', '-s', '-m "Bump {}"'.format(version), '--no-verify')
def validate_environment(version, repository):
if not version.validate():
print('Version "{}" has an invalid format. This should follow D+.D+.D+(-rcD+). '
'Like: 1.26.0 or 1.26.0-rc1'.format(version))
return False
expected_branch = version.branch_name()
if str(repository.active_branch) != expected_branch:
print('Cannot tag in this branch with version "{}". '
'Please checkout "{}" to tag'.format(version, version.branch_name()))
return False
return True
@click.group()
def cli():
pass
@cli.command()
@click.argument('version')
def tag(version):
"""
Updates the version related files and tag
"""
repo = Repo(".")
version = Version(version)
if not validate_environment(version, repo):
return
update_init_py_version(version)
update_run_sh_version(version)
input('Please add the release notes to the CHANGELOG.md file, then press Enter to continue.')
proceed = False
while not proceed:
print(repo.git.diff())
proceed = yesno('Are these changes ok? y/N ', default=False)
if repo.git.diff():
create_bump_commit(repo.git, version)
else:
print('No changes to commit. Exiting...')
return
repo.create_tag(version)
print('Please, check the changes. If everything is OK, you just need to push with:\n'
'$ git push --tags upstream {}'.format(version.branch_name()))
@cli.command()
@click.argument('version')
def push_latest(version):
"""
TODO Pushes the latest tag pointing to a certain GA version
"""
raise NotImplementedError
@cli.command()
@click.argument('version')
def ghtemplate(version):
"""
TODO Generates the github release page content
"""
version = Version(version)
raise NotImplementedError
if __name__ == '__main__':
cli()

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import os
import re

View File

@ -11,7 +11,7 @@ docker run --rm \
"$TAG" tox -e pre-commit
get_versions="docker run --rm
--entrypoint=/code/.tox/py27/bin/python
--entrypoint=/code/.tox/py37/bin/python
$TAG
/code/script/test/versions.py docker/docker-ce,moby/moby"
@ -23,7 +23,7 @@ fi
BUILD_NUMBER=${BUILD_NUMBER-$USER}
PY_TEST_VERSIONS=${PY_TEST_VERSIONS:-py27,py37}
PY_TEST_VERSIONS=${PY_TEST_VERSIONS:-py37}
for version in $DOCKER_VERSIONS; do
>&2 echo "Running tests against Docker $version"

View File

@ -21,10 +21,6 @@ For example, if the list of versions is:
`default` would return `1.7.1` and
`recent -n 3` would return `1.8.0-rc2 1.7.1 1.6.2`
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import itertools
import operator

View File

@ -1,9 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import codecs
import os
import re
@ -108,8 +104,6 @@ setup(
'Environment :: Console',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.6',

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import sys
if sys.version_info >= (2, 7):

View File

@ -1,7 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
import datetime
import json
import os.path

View File

@ -1,7 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import contextlib
import os
from compose.config.config import ConfigDetails

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import tempfile
from ddt import data

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import pytest
from .testcases import DockerClientTestCase

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import copy
import json
import os

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import pytest
from .. import mock

View File

@ -1,17 +1,14 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import os
import re
import shutil
import tempfile
from distutils.spawn import find_executable
from io import StringIO
from os import path
import pytest
from docker.errors import APIError
from docker.errors import ImageNotFound
from six import StringIO
from six import text_type
from .. import mock

View File

@ -2,9 +2,6 @@
Integration tests which cover state convergence (aka smart recreate) performed
by `docker-compose up`.
"""
from __future__ import absolute_import
from __future__ import unicode_literals
import copy
import os
import shutil

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import functools
import os

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import six
from docker.errors import DockerException

View File

@ -1,7 +1,4 @@
# ~*~ encoding: utf-8 ~*~
from __future__ import absolute_import
from __future__ import unicode_literals
import os
import pytest

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import os
import platform
import ssl

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import pytest
from docker.errors import APIError
from requests.exceptions import ConnectionError

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import logging
from compose.cli import colors

View File

@ -1,13 +1,10 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import itertools
from queue import Queue
import pytest
import requests
import six
from docker.errors import APIError
from six.moves.queue import Queue
from compose.cli.log_printer import build_log_generator
from compose.cli.log_printer import build_log_presenters

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import logging
import docker

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import unittest
from compose.cli.utils import human_readable_file_size

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import six
from compose.cli import verbose_proxy

View File

@ -1,7 +1,4 @@
# encoding: utf-8
from __future__ import absolute_import
from __future__ import unicode_literals
import os
import shutil
import tempfile

View File

@ -1,8 +1,4 @@
# encoding: utf-8
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import codecs
import os
import shutil

View File

@ -1,8 +1,4 @@
# encoding: utf-8
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import codecs
import os
import shutil

View File

@ -1,7 +1,4 @@
# encoding: utf-8
from __future__ import absolute_import
from __future__ import unicode_literals
import pytest
from compose.config.environment import Environment

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import pytest
from compose.config.errors import DependencyError

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import pytest
from compose.config.errors import ConfigurationError

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import docker
from .. import mock

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import pytest
from .. import mock

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import unittest
from threading import Lock

View File

@ -1,14 +1,10 @@
# ~*~ encoding: utf-8 ~*~
from __future__ import absolute_import
from __future__ import unicode_literals
import io
import os
import random
import shutil
import tempfile
from six import StringIO
from io import StringIO
from compose import progress_stream
from tests import unittest

View File

@ -1,7 +1,4 @@
# encoding: utf-8
from __future__ import absolute_import
from __future__ import unicode_literals
import datetime
import os
import tempfile

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import docker
import pytest
from docker.constants import DEFAULT_DOCKER_API_VERSION

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
from .. import unittest
from compose.utils import split_buffer

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
from compose import timeparse

View File

@ -1,7 +1,4 @@
# encoding: utf-8
from __future__ import absolute_import
from __future__ import unicode_literals
from compose import utils

View File

@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import docker
import pytest

View File

@ -1,5 +1,5 @@
[tox]
envlist = py27,py37,pre-commit
envlist = py37,pre-commit
[testenv]
usedevelop=True