Drop support for py27

Officially removes support for py27, which was already broken for
3+ months (unmaintained test tools).

Change-Id: I38c966d4e1680592f5cd94695051710695d41f71
Related: https://github.com/testing-cabal/subunit/pull/32
This commit is contained in:
Sorin Sbarnea 2021-01-13 09:34:01 +00:00
parent f4e0e70bb0
commit 3757503895
6 changed files with 13 additions and 33 deletions

View File

@ -17,24 +17,22 @@
from __future__ import print_function
import argparse
import configparser
import datetime
import getpass
import json
import os
import re
import shlex
import six
import subprocess
import sys
import textwrap
from urllib.parse import urlencode
from urllib.parse import urljoin
from urllib.parse import urlparse
import pkg_resources
import requests
from six.moves import configparser
from six.moves import input as do_input
from six.moves.urllib.parse import urlencode
from six.moves.urllib.parse import urljoin
from six.moves.urllib.parse import urlparse
VERBOSE = False
@ -138,11 +136,7 @@ def run_command_status(*argv, **kwargs):
if VERBOSE:
print(datetime.datetime.now(), "Running:", " ".join(argv))
if len(argv) == 1:
# for python2 compatibility with shlex
if sys.version_info < (3,) and isinstance(argv[0], six.text_type):
argv = shlex.split(argv[0].encode('utf-8'))
else:
argv = shlex.split(str(argv[0]))
argv = shlex.split(str(argv[0]))
stdin = kwargs.pop('stdin', None)
newenv = os.environ.copy()
newenv['LANG'] = 'C'
@ -416,7 +410,7 @@ def add_remote(scheme, hostname, port, project, remote, usepushurl):
print("No remote set, testing %s" % remote_url)
if not test_remote_url(remote_url):
print("Could not connect to gerrit.")
username = do_input("Enter your gerrit username: ")
username = input("Enter your gerrit username: ")
remote_url = make_remote_url(scheme, username, hostname, port, project)
print("Trying again with %s" % remote_url)
if not test_remote_url(remote_url):
@ -954,7 +948,7 @@ def assert_one_change(remote, branch, yes, have_hook):
"branches (for independent changes).")
print("\nThe outstanding commits are:\n\n%s\n\n"
"Do you really want to submit the above commits?" % output)
yes_no = do_input("Type 'yes' to confirm, other to cancel: ")
yes_no = input("Type 'yes' to confirm, other to cancel: ")
if yes_no.lower().strip() != "yes":
print("Aborting.")
sys.exit(1)
@ -1729,15 +1723,6 @@ review.
def main():
# workaround for avoiding UnicodeEncodeError on print() with older python
if sys.version_info[0] < 3:
# without reload print would fail even if sys.stdin.encoding
# would report utf-8
# see: https://stackoverflow.com/a/23847316/99834
stdin, stdout, stderr = sys.stdin, sys.stdout, sys.stderr
reload(sys) # noqa
sys.stdin, sys.stdout, sys.stderr = stdin, stdout, stderr
sys.setdefaultencoding(os.environ.get('PYTHONIOENCODING', 'utf-8'))
try:
_main()

View File

@ -17,6 +17,7 @@
import argparse
import functools
import io
import os
import sys
import textwrap
@ -29,13 +30,6 @@ from git_review import cmd
from git_review.tests import IsoEnvDir
from git_review.tests import utils
# Use of io.StringIO in python =< 2.7 requires all strings handled to be
# unicode. See if StringIO.StringIO is available first
try:
import StringIO as io
except ImportError:
import io
class ConfigTestCase(testtools.TestCase):
"""Class testing config behavior."""

View File

@ -1,2 +1 @@
requests>=1.1
six

View File

@ -4,8 +4,9 @@ summary = Tool to submit code to Gerrit
description-file = README.rst
license = Apache License (2.0)
classifiers =
Programming Language :: Python :: 2
Programming Language :: Python :: 3
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python
Development Status :: 5 - Production/Stable
Environment :: Console
@ -19,6 +20,7 @@ author = OpenStack
author-email = openstack-infra@lists.openstack.org
home-page = http://docs.openstack.org/infra/git-review/
project-url = http://docs.openstack.org/infra/
python-requires = >= 3.5
[files]
packages =

View File

@ -17,4 +17,4 @@
import setuptools
setuptools.setup(setup_requires=['pbr'], pbr=True)
setuptools.setup(setup_requires=['pbr>=4.1.0'], pbr=True)

View File

@ -1,5 +1,5 @@
[tox]
envlist = linters,docs,py27,py3{4,5,6,7}
envlist = linters,docs,py3{5,6,7}
ignore_basepython_conflict = true
[testenv]