[PATCH v2] [PW3] Drop Python 2.7

Daniel Axtens dja at axtens.net
Mon Oct 21 16:51:52 AEDT 2019


It will be unsupported by the time of release anyway.

Signed-off-by: Daniel Axtens <dja at axtens.net>

---

v2: remove embarassing rebasing error

My plan for this at the moment is to keep the pw3 topic branch looking
like:

 master ... [fixes] ... drop py2 ... [features] ... xmlrpc

so as we do development, fixes will sit before dropping py2, and
features will sit after droppng py2. This will enable fixes to be
easily backported, but means that features don't have to develop
against both py2 and py3. I'm putting xmlrpc right at the end, so
we can take it or not depending on how we go with the tools.

I want to be able to take things like Andrew's forthcoming Django3
series - which is incompatible with Python 2 - and this seems like the
simplest way to meet everyone's different goals.

Once we get 2.2 out the door and we go back to just developing on
master, we can think about how we want to handle this going forward.
---
 .travis.yml                                   |   2 -
 patchwork/fields.py                           |   4 +-
 patchwork/filters.py                          |   8 +-
 patchwork/management/commands/parsemail.py    |  14 +-
 patchwork/models.py                           |  15 +-
 patchwork/parser.py                           |  54 +--
 patchwork/tests/api/validator.py              |   9 +-
 .../0018-git-pull-request-crlf-newlines.mbox  | 348 ------------------
 patchwork/tests/test_bundles.py               |   7 +-
 patchwork/tests/test_completion.py            |   1 -
 patchwork/tests/test_list.py                  |   1 -
 patchwork/tests/test_management.py            |   2 +-
 patchwork/tests/test_parser.py                |  25 +-
 patchwork/views/utils.py                      |   6 +-
 requirements-dev.txt                          |  12 +-
 requirements-prod.txt                         |   9 +-
 tox.ini                                       |  19 +-
 17 files changed, 49 insertions(+), 487 deletions(-)
 delete mode 100644 patchwork/tests/mail/0018-git-pull-request-crlf-newlines.mbox

diff --git .travis.yml .travis.yml
index cc326840cdb2..ea79f884a88c 100644
--- .travis.yml
+++ .travis.yml
@@ -4,8 +4,6 @@ dist: xenial
 sudo: false
 
 python:
-  - 2.7
-  - 3.5
   - 3.6
   - 3.7
 
diff --git patchwork/fields.py patchwork/fields.py
index dd29ea080319..6eca1a2f150d 100644
--- patchwork/fields.py
+++ patchwork/fields.py
@@ -7,7 +7,6 @@
 import hashlib
 
 from django.db import models
-from django.utils import six
 
 
 class HashField(models.CharField):
@@ -19,7 +18,8 @@ class HashField(models.CharField):
         super(HashField, self).__init__(*args, **kwargs)
 
     def construct(self, value):
-        if isinstance(value, six.text_type):
+        # TODO: should this be unconditional?
+        if isinstance(value, str):
             value = value.encode('utf-8')
         return hashlib.sha1(value)
 
diff --git patchwork/filters.py patchwork/filters.py
index fb644f982136..12288eb9b7c6 100644
--- patchwork/filters.py
+++ patchwork/filters.py
@@ -4,12 +4,11 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
 
 import collections
+from urllib.parse import quote
 
 from django.contrib.auth.models import User
 from django.utils.html import escape
 from django.utils.safestring import mark_safe
-from django.utils import six
-from django.utils.six.moves.urllib.parse import quote
 
 from patchwork.models import Person
 from patchwork.models import Series
@@ -547,8 +546,9 @@ class Filters:
             del params[remove.param]
 
         def sanitise(s):
-            if not isinstance(s, six.string_types):
-                s = six.text_type(s)
+            # TODO: should this be unconditional?
+            if not isinstance(s, str):
+                s = str(s)
             return quote(s.encode('utf-8'))
 
         return '?' + '&'.join(['%s=%s' % (sanitise(k), sanitise(v))
diff --git patchwork/management/commands/parsemail.py patchwork/management/commands/parsemail.py
index ea85e3aabb5c..4c0f1ff1d4d8 100644
--- patchwork/management/commands/parsemail.py
+++ patchwork/management/commands/parsemail.py
@@ -8,7 +8,6 @@ import logging
 import sys
 
 from django.core.management import base
-from django.utils import six
 
 from patchwork.parser import parse_mail
 from patchwork.parser import DuplicateMailError
@@ -37,18 +36,11 @@ class Command(base.BaseCommand):
         try:
             if infile:
                 logger.info('Parsing mail loaded by filename')
-                if six.PY3:
-                    with open(infile, 'rb') as file_:
-                        mail = email.message_from_binary_file(file_)
-                else:
-                    with open(infile) as file_:
-                        mail = email.message_from_file(file_)
+                with open(infile, 'rb') as file_:
+                    mail = email.message_from_binary_file(file_)
             else:
                 logger.info('Parsing mail loaded from stdin')
-                if six.PY3:
-                    mail = email.message_from_binary_file(sys.stdin.buffer)
-                else:
-                    mail = email.message_from_file(sys.stdin)
+                mail = email.message_from_binary_file(sys.stdin.buffer)
         except AttributeError:
             logger.warning("Broken email ignored")
             return
diff --git patchwork/models.py patchwork/models.py
index a908dd5cff40..57bd8c9bd4fb 100644
--- patchwork/models.py
+++ patchwork/models.py
@@ -15,7 +15,6 @@ from django.contrib.auth.models import User
 from django.core.exceptions import ValidationError
 from django.db import models
 from django.urls import reverse
-from django.utils.encoding import python_2_unicode_compatible
 from django.utils.functional import cached_property
 
 from patchwork.fields import HashField
@@ -32,7 +31,6 @@ def validate_regex_compiles(regex_string):
         raise ValidationError('Invalid regular expression entered!')
 
 
- at python_2_unicode_compatible
 class Person(models.Model):
     # properties
 
@@ -55,7 +53,6 @@ class Person(models.Model):
         verbose_name_plural = 'People'
 
 
- at python_2_unicode_compatible
 class Project(models.Model):
     # properties
 
@@ -112,7 +109,6 @@ class Project(models.Model):
         ordering = ['linkname']
 
 
- at python_2_unicode_compatible
 class DelegationRule(models.Model):
     project = models.ForeignKey(Project, on_delete=models.CASCADE)
     user = models.ForeignKey(
@@ -135,7 +131,6 @@ class DelegationRule(models.Model):
         unique_together = (('path', 'project'))
 
 
- at python_2_unicode_compatible
 class UserProfile(models.Model):
     user = models.OneToOneField(User, unique=True, related_name='profile',
                                 on_delete=models.CASCADE)
@@ -213,7 +208,6 @@ def _user_saved_callback(sender, created, instance, **kwargs):
 models.signals.post_save.connect(_user_saved_callback, sender=User)
 
 
- at python_2_unicode_compatible
 class State(models.Model):
     name = models.CharField(max_length=100)
     ordering = models.IntegerField(unique=True)
@@ -230,7 +224,6 @@ class State(models.Model):
         ordering = ['ordering']
 
 
- at python_2_unicode_compatible
 class Tag(models.Model):
     name = models.CharField(max_length=20)
     pattern = models.CharField(
@@ -347,7 +340,7 @@ class EmailMixin(models.Model):
         # Modifying a submission via admin interface changes '\n' newlines in
         # message content to '\r\n'. We need to fix them to avoid problems,
         # especially as git complains about malformed patches when PW runs
-        # on PY2
+        # on PY2 TODO: is this still needed on PY3?
         self.content = self.content.replace('\r\n', '\n')
         super(EmailMixin, self).save(*args, **kwargs)
 
@@ -365,7 +358,6 @@ class FilenameMixin(object):
         return fname
 
 
- at python_2_unicode_compatible
 class Submission(FilenameMixin, EmailMixin, models.Model):
     # parent
 
@@ -418,7 +410,6 @@ class CoverLetter(Submission):
                                'msgid': self.url_msgid})
 
 
- at python_2_unicode_compatible
 class Patch(Submission):
     # patch metadata
 
@@ -659,7 +650,6 @@ class Comment(EmailMixin, models.Model):
         ]
 
 
- at python_2_unicode_compatible
 class Series(FilenameMixin, models.Model):
     """A collection of patches."""
 
@@ -774,7 +764,6 @@ class Series(FilenameMixin, models.Model):
         verbose_name_plural = 'Series'
 
 
- at python_2_unicode_compatible
 class SeriesReference(models.Model):
     """A reference found in a series.
 
@@ -859,7 +848,6 @@ class BundlePatch(models.Model):
         ordering = ['order']
 
 
- at python_2_unicode_compatible
 class Check(models.Model):
 
     """Check for a patch.
@@ -1036,7 +1024,6 @@ class EmailConfirmation(models.Model):
         super(EmailConfirmation, self).save()
 
 
- at python_2_unicode_compatible
 class EmailOptout(models.Model):
     email = models.CharField(max_length=200, primary_key=True)
 
diff --git patchwork/parser.py patchwork/parser.py
index be1e51652dd3..a9271b933ea9 100644
--- patchwork/parser.py
+++ patchwork/parser.py
@@ -16,7 +16,6 @@ import re
 
 from django.contrib.auth.models import User
 from django.db.utils import IntegrityError
-from django.utils import six
 
 from patchwork.models import Comment
 from patchwork.models import CoverLetter
@@ -76,20 +75,13 @@ def sanitise_header(header_contents, header_name=None):
         # (e.g. base64 decoding) We probably can't recover, so:
         return None
 
-    # We have some Py2/Py3 issues here.
+    # We have some issues here.
     #
-    # Firstly, the email parser (before we get here)
-    # Python 3: headers with weird chars are email.header.Header
-    #           class, others as str
-    # Python 2: every header is an str
+    # Firstly, in the email parser (before we get here) headers with weird
+    # chars are email.header.Header class, others as str
     #
-    # Secondly, the behaviour of decode_header:
-    # Python 3: weird headers are labelled as unknown-8bit
-    # Python 2: weird headers are not labelled differently
-    #
-    # Lastly, aking matters worse, in Python2, unknown-8bit doesn't
-    # seem to be supported as an input to make_header, so not only do
-    # we have to detect dodgy headers, we have to fix them ourselves.
+    # Secondly, the behaviour of decode_header: weird headers are labelled
+    # as unknown-8bit
     #
     # We solve this by catching any Unicode errors, and then manually
     # handling any interesting headers.
@@ -98,33 +90,22 @@ def sanitise_header(header_contents, header_name=None):
         header = make_header(value,
                              header_name=header_name,
                              continuation_ws='\t')
-    except (UnicodeDecodeError, LookupError, ValueError, TypeError):
+    except (UnicodeDecodeError, LookupError, ValueError):
         #  - a part cannot be encoded as ascii. (UnicodeDecodeError), or
         #  - we don't have a codec matching the hint (LookupError)
-        #  - the codec has a null byte (Py3 ValueError/Py2 TypeError)
+        #  - the codec has a null byte (ValueError)
         # Find out which part and fix it somehow.
         #
-        # We get here under Py2 when there's non-7-bit chars in header,
-        # or under Py2 or Py3 where decoding with the coding hint fails.
+        # We get here under where decoding with the coding hint fails.
 
         new_value = []
 
-        for (part, coding) in value:
+        for (part, _) in value:
             # We have random bytes that aren't properly coded.
             # If we had a coding hint, it failed to help.
-            if six.PY3:
-                # python3 - force coding to unknown-8bit
-                new_value += [(part, 'unknown-8bit')]
-            else:
-                # python2 - no support in make_header for unknown-8bit
-                # We should do unknown-8bit coding ourselves.
-                # For now, we're just going to replace any dubious
-                # chars with ?.
-                #
-                # TODO: replace it with a proper QP unknown-8bit codec.
-                new_value += [(part.decode('ascii', errors='replace')
-                               .encode('ascii', errors='replace'),
-                               None)]
+
+            # python3 - force coding to unknown-8bit
+            new_value += [(part, 'unknown-8bit')]
 
         header = make_header(new_value,
                              header_name=header_name,
@@ -149,12 +130,7 @@ def clean_header(header):
     if sane_header is None:
         return None
 
-    # on Py2, we want to do unicode(), on Py3, str().
-    # That gets us the decoded, un-wrapped header.
-    if six.PY2:
-        header_str = unicode(sane_header)
-    else:
-        header_str = str(sane_header)
+    header_str = str(sane_header)
 
     return normalise_space(header_str)
 
@@ -572,7 +548,7 @@ def _find_content(mail):
         payload = part.get_payload(decode=True)
         subtype = part.get_content_subtype()
 
-        if not isinstance(payload, six.text_type):
+        if not isinstance(payload, str):
             charset = part.get_content_charset()
 
             # Check that we have a charset that we understand. Otherwise,
@@ -592,7 +568,7 @@ def _find_content(mail):
 
             for cset in try_charsets:
                 try:
-                    new_payload = six.text_type(payload, cset)
+                    new_payload = payload.decode(cset)
                     break
                 except UnicodeDecodeError:
                     new_payload = None
diff --git patchwork/tests/api/validator.py patchwork/tests/api/validator.py
index ad4d7f156cbe..07b2aa74647e 100644
--- patchwork/tests/api/validator.py
+++ patchwork/tests/api/validator.py
@@ -9,7 +9,6 @@ import re
 import django
 from django.urls import resolve
 from django.urls.resolvers import get_resolver
-from django.utils import six
 import openapi_core
 from openapi_core.schema.schemas.models import Format
 from openapi_core.wrappers.base import BaseOpenAPIResponse
@@ -39,7 +38,7 @@ class RegexValidator(object):
         self.regex = re.compile(regex, re.IGNORECASE)
 
     def __call__(self, value):
-        if not isinstance(value, six.text_type):
+        if not isinstance(value, str):
             return False
 
         if not value:
@@ -49,16 +48,16 @@ class RegexValidator(object):
 
 
 CUSTOM_FORMATTERS = {
-    'uri': Format(six.text_type, RegexValidator(
+    'uri': Format(str, RegexValidator(
         r'^(?:http|ftp)s?://'
         r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|'  # noqa
         r'localhost|'
         r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})'
         r'(?::\d+)?'
         r'(?:/?|[/?]\S+)$')),
-    'iso8601': Format(six.text_type, RegexValidator(
+    'iso8601': Format(str, RegexValidator(
         r'^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d{6}$')),
-    'email': Format(six.text_type, RegexValidator(
+    'email': Format(str, RegexValidator(
         r'[^@]+@[^@]+\.[^@]+')),
 }
 
diff --git patchwork/tests/mail/0018-git-pull-request-crlf-newlines.mbox patchwork/tests/mail/0018-git-pull-request-crlf-newlines.mbox
deleted file mode 100644
index bad78aee6d3f..000000000000
--- patchwork/tests/mail/0018-git-pull-request-crlf-newlines.mbox
+++ /dev/null
@@ -1,348 +0,0 @@
-From benh at kernel.crashing.org Fri Oct 22 11:51:02 2010
-Return-Path: <linuxppc-dev-bounces+jk=ozlabs.org at lists.ozlabs.org>
-X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bilbo.ozlabs.org
-X-Spam-Level: 
-X-Spam-Status: No, score=0.0 required=3.0 tests=none autolearn=disabled
-	version=3.3.1
-X-Original-To: jk at ozlabs.org
-Delivered-To: jk at ozlabs.org
-Received: from bilbo.ozlabs.org (localhost [127.0.0.1])
-	by ozlabs.org (Postfix) with ESMTP id ED4B3100937
-	for <jk at ozlabs.org>; Fri, 22 Oct 2010 14:51:54 +1100 (EST)
-Received: by ozlabs.org (Postfix)
-	id BF799B70CB; Fri, 22 Oct 2010 14:51:50 +1100 (EST)
-Delivered-To: linuxppc-dev at ozlabs.org
-Received: from gate.crashing.org (gate.crashing.org [63.228.1.57])
-	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
-	(Client did not present a certificate)
-	by ozlabs.org (Postfix) with ESMTPS id 94629B7043
-	for <linuxppc-dev at ozlabs.org>; Fri, 22 Oct 2010 14:51:49 +1100 (EST)
-Received: from [IPv6:::1] (localhost.localdomain [127.0.0.1])
-	by gate.crashing.org (8.14.1/8.13.8) with ESMTP id o9M3p3SP018234;
-	Thu, 21 Oct 2010 22:51:04 -0500
-Subject: [git pull] Please pull powerpc.git next branch
-From: Benjamin Herrenschmidt <benh at kernel.crashing.org>
-To: Linus Torvalds <torvalds at linux-foundation.org>
-Date: Fri, 22 Oct 2010 14:51:02 +1100
-Message-ID: <1287719462.2198.37.camel at pasglop>
-Mime-Version: 1.0
-X-Mailer: Evolution 2.30.3 
-Cc: linuxppc-dev list <linuxppc-dev at ozlabs.org>,
- Andrew Morton <akpm at linux-foundation.org>,
- Linux Kernel list <linux-kernel at vger.kernel.org>
-X-BeenThere: linuxppc-dev at lists.ozlabs.org
-X-Mailman-Version: 2.1.13
-Precedence: list
-List-Id: Linux on PowerPC Developers Mail List <cbe-oss-dev.ozlabs.org>
-List-Unsubscribe: <https://lists.ozlabs.org/options/linuxppc-dev>,
-	<mailto:linuxppc-dev-request at lists.ozlabs.org?subject=unsubscribe>
-List-Archive: <http://lists.ozlabs.org/pipermail/linuxppc-dev>
-List-Post: <mailto:linuxppc-dev at lists.ozlabs.org>
-List-Help: <mailto:linuxppc-dev-request at lists.ozlabs.org?subject=help>
-List-Subscribe: <https://lists.ozlabs.org/listinfo/linuxppc-dev>,
-	<mailto:linuxppc-dev-request at lists.ozlabs.org?subject=subscribe>
-Content-Type: text/plain;
-  charset="us-ascii"
-Content-Transfer-Encoding: 7bit
-Sender: linuxppc-dev-bounces+jk=ozlabs.org at lists.ozlabs.org
-Errors-To: linuxppc-dev-bounces+jk=ozlabs.org at lists.ozlabs.org
-X-UID: 11446
-X-Length: 16781
-Status: R
-X-Status: N
-X-KMail-EncryptionState:  
-X-KMail-SignatureState:  
-X-KMail-MDN-Sent:  
-
-Hi Linus !
-
-Here's powerpc's batch for this merge window. Mostly bits and pieces,
-such as Anton doing some performance tuning left and right, and the
-usual churn. One hilight is the support for the new Freescale e5500 core
-(64-bit BookE). Another one is that we now wire up the whole lot of
-socket calls as direct syscalls in addition to the old style indirect
-method.
-
-Cheers,
-Ben.
-
-The following changes since commit e10117d36ef758da0690c95ecffc09d5dd7da479:
-  Linus Torvalds (1):
-        Merge branch 'upstream-linus' of git://git.kernel.org/.../jgarzik/libata-dev
-
-are available in the git repository at:
-
-  git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc.git next
-
-Andreas Schwab (1):
-      powerpc: Remove fpscr use from [kvm_]cvt_{fd,df}
-
-Anton Blanchard (5):
-      powerpc: Optimise 64bit csum_partial
-      powerpc: Optimise 64bit csum_partial_copy_generic and add csum_and_copy_from_user
-      powerpc: Add 64bit csum_and_copy_to_user
-      powerpc: Feature nop out reservation clear when stcx checks address
-      powerpc: Check end of stack canary at oops time
-
-Arnd Bergmann (1):
-      powerpc/spufs: Use llseek in all file operations
-
-Benjamin Herrenschmidt (4):
-      powerpc/dma: Add optional platform override of dma_set_mask()
-      powerpc/dart_iommu: Support for 64-bit iommu bypass window on PCIe
-      Merge remote branch 'kumar/merge' into next
-      Merge remote branch 'jwb/next' into next
-
-Denis Kirjanov (1):
-      powerpc: Use is_32bit_task() helper to test 32-bit binary
-
-Harninder Rai (1):
-      powerpc/85xx: add cache-sram support
-
-Ian Munsie (1):
-      powerpc: Wire up direct socket system calls
-
-Ilya Yanok (1):
-      powerpc/mpc83xx: Support for MPC8308 P1M board
-
-Joe Perches (2):
-      powerpc: Use static const char arrays
-      powerpc: Remove pr_<level> uses of KERN_<level>
-
-Josh Boyer (1):
-      powerpc/44x: Update ppc44x_defconfig
-
-Julia Lawall (7):
-      powerpc/via-pmu-led.c: Add of_node_put to avoid memory leak
-      powerpc/maple: Add of_node_put to avoid memory leak
-      powerpc/powermac/pfunc_core.c: Add of_node_put to avoid memory leak
-      powerpc/cell: Add of_node_put to avoid memory leak
-      powerpc/chrp/nvram.c: Add of_node_put to avoid memory leak
-      powerpc/irq.c: Add of_node_put to avoid memory leak
-      i2c/i2c-pasemi.c: Fix unsigned return type
-
-Kumar Gala (11):
-      powerpc/ppc64e: Fix link problem when building ppc64e_defconfig
-      powerpc/fsl-pci: Fix MSI support on 83xx platforms
-      powerpc/mpc8xxx_gpio: Add support for 'qoriq-gpio' controllers
-      powerpc/fsl-booke: Add PCI device ids for P2040/P3041/P5010/P5020 QoirQ chips
-      powerpc/fsl-booke: Add p3041 DS board support
-      powerpc: Fix compile error with paca code on ppc64e
-      powerpc/fsl-booke: Add support for FSL 64-bit e5500 core
-      powerpc/fsl-booke: Add support for FSL Arch v1.0 MMU in setup_page_sizes
-      powerpc/fsl-booke64: Use TLB CAMs to cover linear mapping on FSL 64-bit chips
-      powerpc/fsl-booke: Add p5020 DS board support
-      powerpc/fsl-booke: Add e55xx (64-bit) smp defconfig
-
-Matthew McClintock (7):
-      powerpc/mm: Assume first cpu is boot_cpuid not 0
-      powerpc/kexec: make masking/disabling interrupts generic
-      powerpc/85xx: Remove call to mpic_teardown_this_cpu in kexec
-      powerpc/85xx: Minor fixups for kexec on 85xx
-      powerpc/85xx: flush dcache before resetting cores
-      powerpc/fsl_soc: Search all global-utilities nodes for rstccr
-      powerpc/fsl_booke: Add support to boot from core other than 0
-
-Michael Neuling (1):
-      powerpc: Move arch_sd_sibling_asym_packing() to smp.c
-
-Nathan Fontenot (3):
-      powerpc/pseries: Export device tree updating routines
-      powerpc/pseries: Export rtas_ibm_suspend_me()
-      powerpc/pseries: Partition migration in the kernel
-
-Nishanth Aravamudan (8):
-      powerpc/pci: Fix return type of BUID_{HI,LO} macros
-      powerpc/dma: Fix dma_iommu_dma_supported compare
-      powerpc/dma: Fix check for direct DMA support
-      powerpc/vio: Use put_device() on device_register failure
-      powerpc/viobus: Free TCE table on device release
-      powerpc/pseries: Use kmemdup
-      powerpc/pci: Cleanup device dma setup code
-      powerpc/pseries/xics: Use cpu_possible_mask rather than cpu_all_mask
-
-Paul Gortmaker (1):
-      powerpc: Fix invalid page flags in create TLB CAM path for PTE_64BIT
-
-Paul Mackerras (5):
-      powerpc: Abstract indexing of lppaca structs
-      powerpc: Dynamically allocate most lppaca structs
-      powerpc: Account time using timebase rather than PURR
-      powerpc/pseries: Re-enable dispatch trace log userspace interface
-      powerpc/perf: Fix sampling enable for PPC970
-
-Scott Wood (1):
-      oprofile/fsl emb: Don't set MSR[PMM] until after clearing the interrupt.
-
-Sean MacLennan (2):
-      powerpc: Fix incorrect .stabs entry for copy_32.S
-      powerpc: mtmsrd not defined
-
-Shaohui Xie (1):
-      fsl_rio: Add comments for sRIO registers.
-
-Stephen Rothwell (1):
-      powerpc: define a compat_sys_recv cond_syscall
-
-Timur Tabi (5):
-      powerpc: export ppc_proc_freq and ppc_tb_freq as GPL symbols
-      powerpc/watchdog: Allow the Book-E driver to be compiled as a module
-      powerpc/p1022: Add probing for individual DMA channels
-      powerpc/85xx: add ngPIXIS FPGA device tree node to the P1022DS board
-      powerpc/watchdog: Make default timeout for Book-E watchdog a Kconfig option
-
-Tirumala Marri (1):
-      powerpc/44x: Add support for the AMCC APM821xx SoC
-
-matt mooney (1):
-      powerpc/Makefiles: Change to new flag variables
-
- arch/powerpc/boot/addnote.c                    |    4 +-
- arch/powerpc/boot/dts/bluestone.dts            |  254 +++++++++++++
- arch/powerpc/boot/dts/mpc8308_p1m.dts          |  332 ++++++++++++++++
- arch/powerpc/boot/dts/p1022ds.dts              |   11 +
- arch/powerpc/configs/44x/bluestone_defconfig   |   68 ++++
- arch/powerpc/configs/e55xx_smp_defconfig       |   84 ++++
- arch/powerpc/configs/ppc44x_defconfig          |    9 +-
- arch/powerpc/configs/ppc64e_defconfig          |    4 +-
- arch/powerpc/include/asm/checksum.h            |   10 +
- arch/powerpc/include/asm/compat.h              |    4 +-
- arch/powerpc/include/asm/cputable.h            |   14 +-
- arch/powerpc/include/asm/dma-mapping.h         |   14 +-
- arch/powerpc/include/asm/elf.h                 |    2 +-
- arch/powerpc/include/asm/exception-64s.h       |    3 +-
- arch/powerpc/include/asm/fsl_85xx_cache_sram.h |   48 +++
- arch/powerpc/include/asm/kexec.h               |    1 +
- arch/powerpc/include/asm/kvm_fpu.h             |    4 +-
- arch/powerpc/include/asm/lppaca.h              |   29 ++
- arch/powerpc/include/asm/machdep.h             |    3 +
- arch/powerpc/include/asm/mmu-book3e.h          |   15 +
- arch/powerpc/include/asm/paca.h                |   10 +-
- arch/powerpc/include/asm/page_64.h             |    4 +-
- arch/powerpc/include/asm/ppc-pci.h             |    4 +-
- arch/powerpc/include/asm/ppc_asm.h             |   50 ++-
- arch/powerpc/include/asm/processor.h           |    4 +-
- arch/powerpc/include/asm/pte-common.h          |    7 +
- arch/powerpc/include/asm/rtas.h                |    1 +
- arch/powerpc/include/asm/systbl.h              |   19 +
- arch/powerpc/include/asm/system.h              |    4 +-
- arch/powerpc/include/asm/time.h                |    5 -
- arch/powerpc/include/asm/unistd.h              |   21 +-
- arch/powerpc/kernel/Makefile                   |    4 +-
- arch/powerpc/kernel/align.c                    |    4 +-
- arch/powerpc/kernel/asm-offsets.c              |   12 +-
- arch/powerpc/kernel/cpu_setup_44x.S            |    1 +
- arch/powerpc/kernel/cpu_setup_fsl_booke.S      |   15 +
- arch/powerpc/kernel/cputable.c                 |   43 ++-
- arch/powerpc/kernel/crash.c                    |   13 +-
- arch/powerpc/kernel/dma-iommu.c                |   21 +-
- arch/powerpc/kernel/dma.c                      |   20 +-
- arch/powerpc/kernel/entry_64.S                 |   40 ++
- arch/powerpc/kernel/fpu.S                      |   10 -
- arch/powerpc/kernel/head_fsl_booke.S           |   10 +-
- arch/powerpc/kernel/irq.c                      |    6 +-
- arch/powerpc/kernel/lparcfg.c                  |   14 +-
- arch/powerpc/kernel/machine_kexec.c            |   24 ++
- arch/powerpc/kernel/machine_kexec_32.c         |    4 +
- arch/powerpc/kernel/paca.c                     |   70 ++++-
- arch/powerpc/kernel/pci-common.c               |    4 +-
- arch/powerpc/kernel/ppc970-pmu.c               |    2 +
- arch/powerpc/kernel/process.c                  |   12 -
- arch/powerpc/kernel/ptrace.c                   |    2 +-
- arch/powerpc/kernel/rtas.c                     |    4 +-
- arch/powerpc/kernel/setup_32.c                 |    2 +-
- arch/powerpc/kernel/smp.c                      |   14 +-
- arch/powerpc/kernel/time.c                     |  275 +++++++-------
- arch/powerpc/kernel/traps.c                    |    5 +
- arch/powerpc/kernel/vdso.c                     |    6 +-
- arch/powerpc/kernel/vdso32/Makefile            |    6 +-
- arch/powerpc/kernel/vdso64/Makefile            |    6 +-
- arch/powerpc/kernel/vio.c                      |   10 +-
- arch/powerpc/kvm/Makefile                      |    2 +-
- arch/powerpc/kvm/book3s_paired_singles.c       |   44 +--
- arch/powerpc/kvm/emulate.c                     |    4 +-
- arch/powerpc/kvm/fpu.S                         |    8 -
- arch/powerpc/lib/Makefile                      |    7 +-
- arch/powerpc/lib/checksum_64.S                 |  482 +++++++++++++++++-------
- arch/powerpc/lib/checksum_wrappers_64.c        |  102 +++++
- arch/powerpc/lib/copy_32.S                     |    2 +-
- arch/powerpc/lib/ldstfp.S                      |   36 +-
- arch/powerpc/lib/locks.c                       |    4 +-
- arch/powerpc/lib/sstep.c                       |    8 +
- arch/powerpc/math-emu/Makefile                 |    2 +-
- arch/powerpc/mm/Makefile                       |    6 +-
- arch/powerpc/mm/fault.c                        |    6 +
- arch/powerpc/mm/fsl_booke_mmu.c                |   15 +-
- arch/powerpc/mm/mmu_context_nohash.c           |    6 +-
- arch/powerpc/mm/mmu_decl.h                     |    5 +-
- arch/powerpc/mm/tlb_nohash.c                   |   56 +++-
- arch/powerpc/mm/tlb_nohash_low.S               |    2 +-
- arch/powerpc/oprofile/Makefile                 |    4 +-
- arch/powerpc/oprofile/backtrace.c              |    2 +-
- arch/powerpc/oprofile/op_model_fsl_emb.c       |   15 +-
- arch/powerpc/platforms/44x/Kconfig             |   16 +
- arch/powerpc/platforms/44x/ppc44x_simple.c     |    1 +
- arch/powerpc/platforms/83xx/Kconfig            |    4 +-
- arch/powerpc/platforms/83xx/mpc830x_rdb.c      |    3 +-
- arch/powerpc/platforms/85xx/Kconfig            |   28 ++-
- arch/powerpc/platforms/85xx/Makefile           |    2 +
- arch/powerpc/platforms/85xx/p1022_ds.c         |    2 +
- arch/powerpc/platforms/85xx/p3041_ds.c         |   64 ++++
- arch/powerpc/platforms/85xx/p5020_ds.c         |   69 ++++
- arch/powerpc/platforms/85xx/smp.c              |   83 ++++-
- arch/powerpc/platforms/Kconfig.cputype         |    8 +-
- arch/powerpc/platforms/cell/ras.c              |    4 +-
- arch/powerpc/platforms/cell/spider-pic.c       |    4 +-
- arch/powerpc/platforms/cell/spufs/file.c       |   18 +
- arch/powerpc/platforms/chrp/nvram.c            |    4 +-
- arch/powerpc/platforms/iseries/Makefile        |    2 +-
- arch/powerpc/platforms/iseries/dt.c            |    4 +-
- arch/powerpc/platforms/iseries/smp.c           |    2 +-
- arch/powerpc/platforms/maple/setup.c           |    1 +
- arch/powerpc/platforms/powermac/pfunc_core.c   |    9 +-
- arch/powerpc/platforms/pseries/Makefile        |   13 +-
- arch/powerpc/platforms/pseries/dlpar.c         |    7 +-
- arch/powerpc/platforms/pseries/dtl.c           |  224 +++++++++---
- arch/powerpc/platforms/pseries/lpar.c          |   25 ++-
- arch/powerpc/platforms/pseries/mobility.c      |  362 ++++++++++++++++++
- arch/powerpc/platforms/pseries/pseries.h       |    9 +
- arch/powerpc/platforms/pseries/setup.c         |   52 +++
- arch/powerpc/platforms/pseries/xics.c          |    2 +-
- arch/powerpc/sysdev/Makefile                   |    5 +-
- arch/powerpc/sysdev/dart_iommu.c               |   74 ++++-
- arch/powerpc/sysdev/fsl_85xx_cache_ctlr.h      |  101 +++++
- arch/powerpc/sysdev/fsl_85xx_cache_sram.c      |  159 ++++++++
- arch/powerpc/sysdev/fsl_85xx_l2ctlr.c          |  231 +++++++++++
- arch/powerpc/sysdev/fsl_msi.c                  |    9 +-
- arch/powerpc/sysdev/fsl_pci.c                  |   60 +++-
- arch/powerpc/sysdev/fsl_pci.h                  |    1 +
- arch/powerpc/sysdev/fsl_rio.c                  |   65 ++--
- arch/powerpc/sysdev/fsl_soc.c                  |   20 +-
- arch/powerpc/sysdev/mpc8xxx_gpio.c             |    3 +
- arch/powerpc/sysdev/pmi.c                      |    2 +-
- arch/powerpc/xmon/Makefile                     |    4 +-
- drivers/i2c/busses/i2c-pasemi.c                |    2 +-
- drivers/macintosh/via-pmu-led.c                |    4 +-
- drivers/watchdog/Kconfig                       |   22 +-
- drivers/watchdog/booke_wdt.c                   |   47 ++-
- include/linux/pci_ids.h                        |    8 +
- kernel/sys_ni.c                                |    1 +
- 130 files changed, 3676 insertions(+), 683 deletions(-)
- create mode 100644 arch/powerpc/boot/dts/bluestone.dts
- create mode 100644 arch/powerpc/boot/dts/mpc8308_p1m.dts
- create mode 100644 arch/powerpc/configs/44x/bluestone_defconfig
- create mode 100644 arch/powerpc/configs/e55xx_smp_defconfig
- create mode 100644 arch/powerpc/include/asm/fsl_85xx_cache_sram.h
- create mode 100644 arch/powerpc/lib/checksum_wrappers_64.c
- create mode 100644 arch/powerpc/platforms/85xx/p3041_ds.c
- create mode 100644 arch/powerpc/platforms/85xx/p5020_ds.c
- create mode 100644 arch/powerpc/platforms/pseries/mobility.c
- create mode 100644 arch/powerpc/sysdev/fsl_85xx_cache_ctlr.h
- create mode 100644 arch/powerpc/sysdev/fsl_85xx_cache_sram.c
- create mode 100644 arch/powerpc/sysdev/fsl_85xx_l2ctlr.c
-
-
-_______________________________________________
-Linuxppc-dev mailing list
-Linuxppc-dev at lists.ozlabs.org
-https://lists.ozlabs.org/listinfo/linuxppc-dev
diff --git patchwork/tests/test_bundles.py patchwork/tests/test_bundles.py
index e904b11c80a8..63f943c033d6 100644
--- patchwork/tests/test_bundles.py
+++ patchwork/tests/test_bundles.py
@@ -11,9 +11,6 @@ from django.conf import settings
 from django.test import TestCase
 from django.urls import reverse
 from django.utils.http import urlencode
-from django.utils import six
-from django.utils.six.moves import range
-from django.utils.six.moves import zip
 
 from patchwork.models import Bundle
 from patchwork.models import BundlePatch
@@ -117,14 +114,14 @@ class BundleMboxTest(BundleTestBase):
     def test_empty_bundle(self):
         response = self.client.get(bundle_mbox_url(self.bundle))
         self.assertEqual(response.status_code, 200)
-        self.assertEqual(response.content, six.b(''))
+        self.assertEqual(response.content, b'')
 
     def test_non_empty_bundle(self):
         self.bundle.append_patch(self.patches[0])
 
         response = self.client.get(bundle_mbox_url(self.bundle))
         self.assertEqual(response.status_code, 200)
-        self.assertNotEqual(response.content, six.b(''))
+        self.assertNotEqual(response.content, b'')
 
 
 class BundleUpdateTest(BundleTestBase):
diff --git patchwork/tests/test_completion.py patchwork/tests/test_completion.py
index ebcac669a2ee..1b1a18dfc5ec 100644
--- patchwork/tests/test_completion.py
+++ patchwork/tests/test_completion.py
@@ -7,7 +7,6 @@ import json
 
 from django.test import TestCase
 from django.urls import reverse
-from django.utils.six.moves import range
 
 from patchwork.tests.utils import create_person
 
diff --git patchwork/tests/test_list.py patchwork/tests/test_list.py
index 1c0503fa693b..4466fa3592a9 100644
--- patchwork/tests/test_list.py
+++ patchwork/tests/test_list.py
@@ -8,7 +8,6 @@ import re
 
 from django.test import TestCase
 from django.urls import reverse
-from django.utils.six.moves import zip
 
 from patchwork.models import Patch
 from patchwork.tests.utils import create_patch
diff --git patchwork/tests/test_management.py patchwork/tests/test_management.py
index 84a3839d94c9..66c6bad643a4 100644
--- patchwork/tests/test_management.py
+++ patchwork/tests/test_management.py
@@ -5,9 +5,9 @@
 
 import os
 import sys
+from io import StringIO
 
 from django.core.management import call_command
-from django.utils.six import StringIO
 from django.test import TestCase
 
 from patchwork import models
diff --git patchwork/tests/test_parser.py patchwork/tests/test_parser.py
index 85c6c52f0e4b..29a5c8b48b8c 100644
--- patchwork/tests/test_parser.py
+++ patchwork/tests/test_parser.py
@@ -9,12 +9,9 @@ from email.mime.multipart import MIMEMultipart
 from email.mime.text import MIMEText
 from email.utils import make_msgid
 import os
-import sys
-import unittest
 
 from django.test import TestCase
 from django.test import TransactionTestCase
-from django.utils import six
 
 from patchwork.models import Comment
 from patchwork.models import Patch
@@ -44,12 +41,8 @@ from patchwork.tests.utils import SAMPLE_DIFF
 
 
 def load_mail(file_path):
-    if six.PY3:
-        with open(file_path, 'rb') as f:
-            mail = email.message_from_binary_file(f)
-    else:
-        with open(file_path) as f:
-            mail = email.message_from_file(f)
+    with open(file_path, 'rb') as f:
+        mail = email.message_from_binary_file(f)
     return mail
 
 
@@ -586,19 +579,6 @@ class PatchParseTest(PatchTest):
     def test_git_pull_request(self):
         self._test_pull_request_parse('0001-git-pull-request.mbox')
 
-    @unittest.skipIf(six.PY3, 'Breaks only on Python 2')
-    def test_git_pull_request_crlf_newlines(self):
-        # verify that we haven't munged the file
-        crlf_file = os.path.join(TEST_MAIL_DIR,
-                                 '0018-git-pull-request-crlf-newlines.mbox')
-        with open(crlf_file) as f:
-            message = f.read()
-            self.assertIn('\r\n', message)
-
-        # verify the file works
-        self._test_pull_request_parse(
-            '0018-git-pull-request-crlf-newlines.mbox')
-
     def test_git_pull_wrapped_request(self):
         self._test_pull_request_parse('0002-git-pull-request-wrapped.mbox')
 
@@ -1044,6 +1024,7 @@ class WeirdMailTest(TransactionTestCase):
 
     @unittest.skipUnless((3, 0) <= sys.version_info < (3, 7),
                          'Breaks only on Python 3.0 - 3.6')
+
     def test_early_fail(self):
         file_path = os.path.join(TEST_FUZZ_DIR, 'earlyfail.mbox')
         with self.assertRaises(AttributeError):
diff --git patchwork/views/utils.py patchwork/views/utils.py
index 905807935459..4419702ee8c0 100644
--- patchwork/views/utils.py
+++ patchwork/views/utils.py
@@ -14,7 +14,6 @@ import re
 
 from django.conf import settings
 from django.http import Http404
-from django.utils import six
 
 from patchwork.models import Comment
 from patchwork.models import Patch
@@ -110,10 +109,7 @@ def _submission_to_mbox(submission):
         mail['Date'] = email.utils.formatdate(utc_timestamp)
 
     # NOTE(stephenfin) http://stackoverflow.com/a/28584090/613428
-    if six.PY3:
-        mail = mail.as_bytes(True).decode()
-    else:
-        mail = mail.as_string(True)
+    mail = mail.as_bytes(True).decode()
 
     return mail
 
diff --git requirements-dev.txt requirements-dev.txt
index 60eb8a630719..5f8803ef1b82 100644
--- requirements-dev.txt
+++ requirements-dev.txt
@@ -1,10 +1,6 @@
-Django~=2.2.0; python_version >= '3.5'
-Django~=1.11.0; python_version < '3.0'  # pyup: ignore
-djangorestframework~=3.10.0; python_version >= '3.5'
-djangorestframework~=3.9.0; python_version < '3.0'  # pyup: ignore
-django-filter~=2.2.0; python_version >= '3.5'
-django-filter~=1.1.0; python_version < '3.0'  # pyup: ignore
-django-debug-toolbar~=2.0.0; python_version >= '3.5'  # pyup: ignore
-django-debug-toolbar~=1.11.0; python_version < '3.0'  # pyup: ignore
+Django~=2.2.0
+djangorestframework~=3.10.0
+django-filter~=2.2.0
+django-debug-toolbar~=2.0.0  # pyup: ignore
 django-dbbackup~=3.2.0
 -r requirements-test.txt
diff --git requirements-prod.txt requirements-prod.txt
index 797d30bbb2e5..98030ff1b7cd 100644
--- requirements-prod.txt
+++ requirements-prod.txt
@@ -1,8 +1,5 @@
-Django~=2.2.0; python_version >= '3.5'
-Django~=1.11.0; python_version < '3.0'  # pyup: ignore
-djangorestframework~=3.10.0; python_version >= '3.5'
-djangorestframework~=3.9.0; python_version < '3.0'  # pyup: ignore
-django-filter~=2.2.0; python_version >= '3.5'
-django-filter~=1.1.0; python_version < '3.0'  # pyup: ignore
+Django~=2.2.0
+djangorestframework~=3.10.0
+django-filter~=2.2.0
 psycopg2-binary~=2.8.0
 sqlparse~=0.3.0
diff --git tox.ini tox.ini
index 617e73cdbee6..32caa866431f 100644
--- tox.ini
+++ tox.ini
@@ -1,16 +1,11 @@
 [tox]
 minversion = 2.0
-envlist = pep8,docs,py27-django111,py{35,36,37}-django{111,20,21,22}
+envlist = pep8,docs,py{36,37}-django{20,21,22}
 skipsdist = True
 
 [testenv]
 deps =
     -r{toxinidir}/requirements-test.txt
-    django111: django>=1.11,<2.0
-    django111: djangorestframework>=3.6,<3.11; python_version >= '3.5'
-    django111: djangorestframework>=3.6,<3.10; python_version < '3.0'
-    django111: django-filter>=1.0,<3.0; python_version >= '3.5'
-    django111: django-filter>=1.0,<2.0; python_version < '3.0'
     django20: django>=2.0,<2.1
     django21: django>=2.1,<2.2
     django{20,21}: djangorestframework>=3.7,<3.11
@@ -22,9 +17,7 @@ setenv =
     DJANGO_SETTINGS_MODULE = patchwork.settings.dev
     PYTHONDONTWRITEBYTECODE = 1
     DJANGO_LIVE_TEST_SERVER_ADDRESS = localhost:9000-9200
-    py27: PYTHONWARNINGS = once
-    py{34,36}:PYTHONWARNINGS = once,ignore::ImportWarning:backports
-    py35:PYTHONWARNINGS = once,ignore::ResourceWarning:unittest.suite,ignore::ImportWarning:backports
+    py36:PYTHONWARNINGS = once,ignore::ImportWarning:backports
 passenv =
     http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
     PW_TEST_DB_TYPE PW_TEST_DB_USER PW_TEST_DB_PASS PW_TEST_DB_HOST
@@ -42,7 +35,7 @@ commands =
     -name \*.sh -print | xargs bashate -i E006"
 
 [testenv:pep8]
-basepython = python2.7
+basepython = python3.6
 deps = flake8
 commands = flake8 {posargs:patchwork manage.py}
 
@@ -62,7 +55,7 @@ commands =
     sphinx-build -E -W -b dirhtml -d docs/_build/doctrees docs docs/_build/html
 
 [testenv:lint]
-basepython = python2.7
+basepython = python3.6
 deps =
     pylint
     -r{toxinidir}/requirements-prod.txt
@@ -72,7 +65,7 @@ commands = pylint patchwork --rcfile=pylint.rc
 commands = {posargs}
 
 [testenv:coverage]
-basepython = python2.7
+basepython = python3.6
 deps =
     coverage
     -r{toxinidir}/requirements-dev.txt
@@ -86,4 +79,4 @@ commands =
 
 [travis]
 python =
-    2.7: py27, pep8
+    3.6: py36, pep8
-- 
2.20.1



More information about the Patchwork mailing list