From 64d11912e2bd4f6af72fd23a7656b9a347536732 Mon Sep 17 00:00:00 2001 From: Daniel Axtens Date: Fri, 30 Aug 2019 17:36:43 +1000 Subject: Clean up references to Python 2.7, Python 3.5 Both this and the version of Django we were running with it are EOL upstream. It's time to drop them. Signed-off-by: Daniel Axtens Signed-off-by: Stephen Finucane --- patchwork/fields.py | 4 +- patchwork/filters.py | 8 +- patchwork/management/commands/parsemail.py | 14 +- patchwork/models.py | 17 +- patchwork/parser.py | 49 +-- patchwork/tests/api/validator.py | 9 +- .../mail/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 | 22 +- patchwork/tests/test_xmlrpc.py | 2 +- patchwork/views/utils.py | 6 +- patchwork/views/xmlrpc.py | 35 +-- requirements-dev.txt | 10 +- requirements-prod.txt | 10 +- 17 files changed, 61 insertions(+), 484 deletions(-) delete mode 100644 patchwork/tests/mail/0018-git-pull-request-crlf-newlines.mbox diff --git a/patchwork/fields.py b/patchwork/fields.py index dd29ea0..6eca1a2 100644 --- a/patchwork/fields.py +++ b/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 a/patchwork/filters.py b/patchwork/filters.py index fb644f9..12288eb 100644 --- a/patchwork/filters.py +++ b/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 a/patchwork/management/commands/parsemail.py b/patchwork/management/commands/parsemail.py index ea85e3a..4c0f1ff 100644 --- a/patchwork/management/commands/parsemail.py +++ b/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 a/patchwork/models.py b/patchwork/models.py index e295e17..769f602 100644 --- a/patchwork/models.py +++ b/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!') -@python_2_unicode_compatible class Person(models.Model): # properties @@ -55,7 +53,6 @@ class Person(models.Model): verbose_name_plural = 'People' -@python_2_unicode_compatible class Project(models.Model): # properties @@ -113,7 +110,6 @@ class Project(models.Model): ordering = ['linkname'] -@python_2_unicode_compatible class DelegationRule(models.Model): project = models.ForeignKey(Project, on_delete=models.CASCADE) user = models.ForeignKey( @@ -136,7 +132,6 @@ class DelegationRule(models.Model): unique_together = (('path', 'project')) -@python_2_unicode_compatible class UserProfile(models.Model): user = models.OneToOneField(User, unique=True, related_name='profile', on_delete=models.CASCADE) @@ -214,7 +209,6 @@ def _user_saved_callback(sender, created, instance, **kwargs): models.signals.post_save.connect(_user_saved_callback, sender=User) -@python_2_unicode_compatible class State(models.Model): # Both of these fields should be unique name = models.CharField(max_length=100, unique=True) @@ -229,7 +223,6 @@ class State(models.Model): ordering = ['ordering'] -@python_2_unicode_compatible class Tag(models.Model): name = models.CharField(max_length=20) pattern = models.CharField( @@ -346,10 +339,9 @@ 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 if self.content: + # on PY2 TODO: is this still needed on PY3? self.content = self.content.replace('\r\n', '\n') - super(EmailMixin, self).save(*args, **kwargs) class Meta: @@ -366,7 +358,6 @@ class FilenameMixin(object): return fname -@python_2_unicode_compatible class Submission(FilenameMixin, EmailMixin, models.Model): # parent @@ -419,7 +410,6 @@ class CoverLetter(Submission): 'msgid': self.url_msgid}) -@python_2_unicode_compatible class Patch(Submission): # patch metadata @@ -670,7 +660,6 @@ class Comment(EmailMixin, models.Model): ] -@python_2_unicode_compatible class Series(FilenameMixin, models.Model): """A collection of patches.""" @@ -785,7 +774,6 @@ class Series(FilenameMixin, models.Model): verbose_name_plural = 'Series' -@python_2_unicode_compatible class SeriesReference(models.Model): """A reference found in a series. @@ -871,7 +859,6 @@ class BundlePatch(models.Model): ordering = ['order'] -@python_2_unicode_compatible class PatchRelation(models.Model): def __str__(self): @@ -884,7 +871,6 @@ class PatchRelation(models.Model): return name -@python_2_unicode_compatible class Check(models.Model): """Check for a patch. @@ -1076,7 +1062,6 @@ class EmailConfirmation(models.Model): super(EmailConfirmation, self).save() -@python_2_unicode_compatible class EmailOptout(models.Model): email = models.CharField(max_length=200, primary_key=True) diff --git a/patchwork/parser.py b/patchwork/parser.py index 45930b4..4c2d51d 100644 --- a/patchwork/parser.py +++ b/patchwork/parser.py @@ -17,7 +17,6 @@ import re from django.contrib.auth.models import User from django.db.utils import IntegrityError from django.db import transaction -from django.utils import six from patchwork.models import Comment from patchwork.models import CoverLetter @@ -87,20 +86,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. @@ -109,33 +101,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, @@ -160,7 +141,7 @@ def clean_header(header): if sane_header is None: return None - header_str = six.text_type(sane_header) + header_str = str(sane_header) return normalise_space(header_str) @@ -588,7 +569,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, @@ -608,7 +589,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 a/patchwork/tests/api/validator.py b/patchwork/tests/api/validator.py index 9cead29..6700639 100644 --- a/patchwork/tests/api/validator.py +++ b/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 a/patchwork/tests/mail/0018-git-pull-request-crlf-newlines.mbox b/patchwork/tests/mail/0018-git-pull-request-crlf-newlines.mbox deleted file mode 100644 index bad78ae..0000000 --- a/patchwork/tests/mail/0018-git-pull-request-crlf-newlines.mbox +++ /dev/null @@ -1,348 +0,0 @@ -From benh@kernel.crashing.org Fri Oct 22 11:51:02 2010 -Return-Path: -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@ozlabs.org -Delivered-To: jk@ozlabs.org -Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) - by ozlabs.org (Postfix) with ESMTP id ED4B3100937 - for ; 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@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 ; 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 -To: Linus Torvalds -Date: Fri, 22 Oct 2010 14:51:02 +1100 -Message-ID: <1287719462.2198.37.camel@pasglop> -Mime-Version: 1.0 -X-Mailer: Evolution 2.30.3 -Cc: linuxppc-dev list , - Andrew Morton , - Linux Kernel list -X-BeenThere: linuxppc-dev@lists.ozlabs.org -X-Mailman-Version: 2.1.13 -Precedence: list -List-Id: Linux on PowerPC Developers Mail List -List-Unsubscribe: , - -List-Archive: -List-Post: -List-Help: -List-Subscribe: , - -Content-Type: text/plain; - charset="us-ascii" -Content-Transfer-Encoding: 7bit -Sender: linuxppc-dev-bounces+jk=ozlabs.org@lists.ozlabs.org -Errors-To: linuxppc-dev-bounces+jk=ozlabs.org@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_ uses of KERN_ - -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@lists.ozlabs.org -https://lists.ozlabs.org/listinfo/linuxppc-dev diff --git a/patchwork/tests/test_bundles.py b/patchwork/tests/test_bundles.py index e904b11..63f943c 100644 --- a/patchwork/tests/test_bundles.py +++ b/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 a/patchwork/tests/test_completion.py b/patchwork/tests/test_completion.py index ebcac66..1b1a18d 100644 --- a/patchwork/tests/test_completion.py +++ b/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 a/patchwork/tests/test_list.py b/patchwork/tests/test_list.py index c6ccd0d..c11a992 100644 --- a/patchwork/tests/test_list.py +++ b/patchwork/tests/test_list.py @@ -10,7 +10,6 @@ import re from django.conf import settings 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 a/patchwork/tests/test_management.py b/patchwork/tests/test_management.py index 84a3839..66c6bad 100644 --- a/patchwork/tests/test_management.py +++ b/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 a/patchwork/tests/test_parser.py b/patchwork/tests/test_parser.py index 6fbc9da..f5631be 100644 --- a/patchwork/tests/test_parser.py +++ b/patchwork/tests/test_parser.py @@ -14,7 +14,6 @@ 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 +43,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 @@ -589,19 +584,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') diff --git a/patchwork/tests/test_xmlrpc.py b/patchwork/tests/test_xmlrpc.py index 79c6c84..6dcbca9 100644 --- a/patchwork/tests/test_xmlrpc.py +++ b/patchwork/tests/test_xmlrpc.py @@ -4,11 +4,11 @@ # SPDX-License-Identifier: GPL-2.0-or-later import unittest +from xmlrpc import client as xmlrpc_client from django.conf import settings from django.test import LiveServerTestCase from django.urls import reverse -from django.utils.six.moves import xmlrpc_client from patchwork.tests import utils diff --git a/patchwork/views/utils.py b/patchwork/views/utils.py index 9058079..4419702 100644 --- a/patchwork/views/utils.py +++ b/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 a/patchwork/views/xmlrpc.py b/patchwork/views/xmlrpc.py index f607250..6701bf2 100644 --- a/patchwork/views/xmlrpc.py +++ b/patchwork/views/xmlrpc.py @@ -4,11 +4,7 @@ # SPDX-License-Identifier: GPL-2.0-or-later import base64 -# NOTE(stephenfin) six does not seem to support this -try: - from DocXMLRPCServer import XMLRPCDocGenerator -except ImportError: - from xmlrpc.server import XMLRPCDocGenerator +from xmlrpc.server import XMLRPCDocGenerator import sys from django.contrib.auth import authenticate @@ -17,9 +13,8 @@ from django.http import HttpResponseRedirect from django.http import HttpResponseServerError from django.views.decorators.csrf import csrf_exempt from django.urls import reverse -from django.utils import six -from django.utils.six.moves import xmlrpc_client -from django.utils.six.moves.xmlrpc_server import SimpleXMLRPCDispatcher +from xmlrpc import client as xmlrpc_client +from xmlrpc.server import SimpleXMLRPCDispatcher from patchwork.models import Check from patchwork.models import Patch @@ -97,18 +92,18 @@ class PatchworkXMLRPCDispatcher(SimpleXMLRPCDispatcher, def _marshaled_dispatch(self, request): try: - params, method = six.moves.xmlrpc_client.loads(request.body) + params, method = xmlrpc_client.loads(request.body) response = self._dispatch(request, method, params) # wrap response in a singleton tuple response = (response,) response = self.dumps(response, methodresponse=1) - except six.moves.xmlrpc_client.Fault as fault: + except xmlrpc_client.Fault as fault: response = self.dumps(fault) except Exception: # noqa # report exception back to server response = self.dumps( - six.moves.xmlrpc_client.Fault( + xmlrpc_client.Fault( 1, '%s:%s' % (sys.exc_info()[0], sys.exc_info()[1])), ) @@ -217,7 +212,7 @@ def person_to_dict(obj): 'id': obj.id, 'email': obj.email, 'name': name, - 'user': six.text_type(obj.user).encode('utf-8'), + 'user': str(obj.user).encode('utf-8'), } @@ -254,18 +249,18 @@ def patch_to_dict(obj): """ return { 'id': obj.id, - 'date': six.text_type(obj.date).encode('utf-8'), + 'date': str(obj.date).encode('utf-8'), 'filename': obj.filename, 'msgid': obj.msgid, 'name': obj.name, - 'project': six.text_type(obj.project).encode('utf-8'), + 'project': str(obj.project).encode('utf-8'), 'project_id': obj.project_id, - 'state': six.text_type(obj.state).encode('utf-8'), + 'state': str(obj.state).encode('utf-8'), 'state_id': obj.state_id, 'archived': obj.archived, - 'submitter': six.text_type(obj.submitter).encode('utf-8'), + 'submitter': str(obj.submitter).encode('utf-8'), 'submitter_id': obj.submitter_id, - 'delegate': six.text_type(obj.delegate).encode('utf-8'), + 'delegate': str(obj.delegate).encode('utf-8'), 'delegate_id': obj.delegate_id or 0, 'commit_ref': obj.commit_ref or '', 'hash': obj.hash or '', @@ -300,10 +295,10 @@ def check_to_dict(obj): object which is OK to send to the client.""" return { 'id': obj.id, - 'date': six.text_type(obj.date).encode('utf-8'), - 'patch': six.text_type(obj.patch).encode('utf-8'), + 'date': str(obj.date).encode('utf-8'), + 'patch': str(obj.patch).encode('utf-8'), 'patch_id': obj.patch_id, - 'user': six.text_type(obj.user).encode('utf-8'), + 'user': str(obj.user).encode('utf-8'), 'user_id': obj.user_id, 'state': obj.get_state_display(), 'target_url': obj.target_url, diff --git a/requirements-dev.txt b/requirements-dev.txt index 4415209..1a076a6 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,6 +1,6 @@ -Django~=2.2.0; python_version >= '3.5' # pyup: >= 2.2.0,<2.3.0 -djangorestframework~=3.11.0; python_version >= '3.5' -django-filter~=2.2.0; python_version >= '3.5' # pyup: >=2.2.0,<2.3.0 -django-debug-toolbar~=2.0.0; python_version >= '3.5' # pyup: ignore -django-dbbackup~=3.2.0 # pyup: >=3.2.0,<3.3.0 +Django~=2.2.0 +djangorestframework~=3.11.0 +django-filter~=2.2.0 +django-debug-toolbar~=2.0.0 +django-dbbackup~=3.2.0 -r requirements-test.txt diff --git a/requirements-prod.txt b/requirements-prod.txt index f6477ac..3d83491 100644 --- a/requirements-prod.txt +++ b/requirements-prod.txt @@ -1,5 +1,5 @@ -Django~=2.2.0; python_version >= '3.5' # pyup: >=2.2.0,<2.3.0 -djangorestframework~=3.11.0; python_version >= '3.5' # pyup: >=3.10.0,<3.12.0 -django-filter~=2.2.0; python_version >= '3.5' # pyup: >=2.2.0,<2.3.0 -psycopg2-binary~=2.8.0 # pyup: >=2.8.0,<2.9.0 -sqlparse~=0.3.0 # pyup: >=0.3.0,<0.4.0 +Django~=2.2.0 +djangorestframework~=3.11.0 +django-filter~=2.2.0 +psycopg2-binary~=2.8.0 +sqlparse~=0.3.0 -- cgit v1.2.3