lists.arthurdejong.org
RSS feed

python-pskc branch master updated. 1.2-12-ge99f7c8

[Date Prev][Date Next] [Thread Prev][Thread Next]

python-pskc branch master updated. 1.2-12-ge99f7c8



This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "python-pskc".

The branch, master has been updated
       via  e99f7c850a7c33de20b7664b58c6c6f133fdedc1 (commit)
      from  5cbd43fd77008387954ce8b802ef2aa9e4a7daa2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://arthurdejong.org/git/python-pskc/commit/?id=e99f7c850a7c33de20b7664b58c6c6f133fdedc1

commit e99f7c850a7c33de20b7664b58c6c6f133fdedc1
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Wed Jul 17 22:38:56 2024 +0200

    Drop Python 2 support
    
    It is getting more and more annoying to support Python 2 due to
    difficulty in testing.

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 88f2594..179ee1c 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -9,27 +9,12 @@ on:
     - cron: '9 0 * * 1'
 
 jobs:
-  base_py27:
-    runs-on: ubuntu-20.04
-    container:
-      image: python:2.7.18-buster
-    strategy:
-      fail-fast: false
-      matrix:
-        python-version: [2.7]
-        flavour: [signxml, legacy, legacy-defusedxml, lxml, lxml-defusedxml]
-    steps:
-      - uses: actions/checkout@v3
-      - name: Install dependencies
-        run: python -m pip install --upgrade pip virtualenv tox
-      - name: Run tox
-        run: tox -e "$(echo py${{ matrix.python-version }}-${{ matrix.flavour 
}} | sed -e 's/[.]//g;s/pypypy/pypy/')" --skip-missing-interpreters false
   base:
     runs-on: ubuntu-20.04
     strategy:
       fail-fast: false
       matrix:
-        python-version: [3.6, 3.7, 3.8, 3.9, '3.10', 3.11, 3.12, pypy2.7, 
pypy3.8, pypy3.9]
+        python-version: [3.6, 3.7, 3.8, 3.9, '3.10', 3.11, 3.12, pypy3.8, 
pypy3.9]
         flavour: [signxml]
     steps:
       - uses: actions/checkout@v3
diff --git a/pskc/crypto/aeskw.py b/pskc/crypto/aeskw.py
index 48d738e..fbe070f 100644
--- a/pskc/crypto/aeskw.py
+++ b/pskc/crypto/aeskw.py
@@ -1,7 +1,7 @@
 # aeskw.py - implementation of AES key wrapping
 # coding: utf-8
 #
-# Copyright (C) 2014-2017 Arthur de Jong
+# Copyright (C) 2014-2024 Arthur de Jong
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -31,10 +31,7 @@ from pskc.exceptions import DecryptionError, EncryptionError
 
 def _strxor(a, b):
     """Return a XOR b."""
-    if isinstance(b'', str):  # pragma: no cover (Python 2 specific)
-        return b''.join(chr(ord(x) ^ ord(y)) for (x, y) in zip(a, b))
-    else:  # pragma: no cover (Python 3 specific)
-        return bytes(x ^ y for (x, y) in zip(a, b))
+    return bytes(x ^ y for (x, y) in zip(a, b))
 
 
 def _split(value):
diff --git a/pskc/encryption.py b/pskc/encryption.py
index 1ffc3ac..13e83ee 100644
--- a/pskc/encryption.py
+++ b/pskc/encryption.py
@@ -1,7 +1,7 @@
 # encryption.py - module for handling encrypted values
 # coding: utf-8
 #
-# Copyright (C) 2014-2018 Arthur de Jong
+# Copyright (C) 2014-2024 Arthur de Jong
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -226,9 +226,9 @@ class KeyDerivation(object):
         if not all((password, self.pbkdf2_salt, self.pbkdf2_key_length,
                     self.pbkdf2_iterations)):
             raise KeyDerivationError('Incomplete PBKDF2 configuration')
-        # force conversion to bytestring on Python 3
+        # force conversion to bytestring
         if not isinstance(password, type(b'')):
-            password = password.encode()  # pragma: no cover (Py3 specific)
+            password = password.encode()
         try:
             return pbkdf2_hmac(
                 prf, password, self.pbkdf2_salt, self.pbkdf2_iterations,
diff --git a/pskc/key.py b/pskc/key.py
index 903bfbd..499f273 100644
--- a/pskc/key.py
+++ b/pskc/key.py
@@ -1,7 +1,7 @@
 # key.py - module for handling keys from pskc files
 # coding: utf-8
 #
-# Copyright (C) 2014-2022 Arthur de Jong
+# Copyright (C) 2014-2024 Arthur de Jong
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -38,9 +38,9 @@ class EncryptedValue(object):
     @classmethod
     def create(cls, pskc, value):
         """Construct an encrypted value from a plaintext value."""
-        # force conversion to bytestring on Python 3
+        # force conversion to bytestring
         if not isinstance(value, (type(b''), bytearray)):
-            value = value.encode()  # pragma: no cover (Python 3 specific)
+            value = value.encode()
         cipher_value = pskc.encryption.encrypt_value(value)
         mac_value = None
         if pskc.mac.algorithm:
diff --git a/pskc/serialiser.py b/pskc/serialiser.py
index beba1f4..863d907 100644
--- a/pskc/serialiser.py
+++ b/pskc/serialiser.py
@@ -1,7 +1,7 @@
 # serialiser.py - PSKC file parsing functions
 # coding: utf-8
 #
-# Copyright (C) 2016-2018 Arthur de Jong
+# Copyright (C) 2016-2024 Arthur de Jong
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -30,7 +30,7 @@ from pskc.xml import find, mk_elem, move_namespaces, 
reformat, tostring
 def my_b64encode(value):
     """Wrap around b64encode to handle types correctly."""
     if not isinstance(value, type(b'')):
-        value = value.encode()  # pragma: no cover (Python 3 specific)
+        value = value.encode()
     return base64.b64encode(value).decode()
 
 
@@ -43,8 +43,8 @@ class PSKCSerialiser(object):
         xml = tostring(cls.serialise_document(pskc))
         try:
             output.write(xml)
-        except TypeError:  # pragma: no cover (Python 3 specific)
-            # fall back to writing as string for Python 3
+        except TypeError:
+            # fall back to writing as string
             output.write(xml.decode('utf-8'))
 
     @classmethod
diff --git a/setup.py b/setup.py
index 016c792..f818aa5 100755
--- a/setup.py
+++ b/setup.py
@@ -2,7 +2,7 @@
 
 # setup.py - python-pskc installation script
 #
-# Copyright (C) 2014-2023 Arthur de Jong
+# Copyright (C) 2014-2024 Arthur de Jong
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -57,8 +57,6 @@ setup(
         'License :: OSI Approved :: GNU Lesser General Public License v2 or 
later (LGPLv2+)',
         'Operating System :: OS Independent',
         'Programming Language :: Python',
-        'Programming Language :: Python :: 2',
-        'Programming Language :: Python :: 2.7',
         'Programming Language :: Python :: 3',
         'Programming Language :: Python :: 3.6',
         'Programming Language :: Python :: 3.7',
diff --git a/tox.ini b/tox.ini
index 39b5382..480d1df 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,12 +1,11 @@
 [tox]
-envlist = 
py{27,36,37,38,39,310,312,py,py3}-signxml,py{27,36,37,38,39,310,311,312,py,py3}{-legacy,-lxml}{,-defusedxml},flake8,docs,codespell
+envlist = 
py{36,37,38,39,310,312,py,py3}-signxml,py{36,37,38,39,310,311,312,py,py3}{-legacy,-lxml}{,-defusedxml},flake8,docs,codespell
 skip_missing_interpreters = true
 
 [testenv]
 deps = pytest
        pytest-cov
-       signxml: signxml<2.10.1;python_version<"3.6"
-       signxml: signxml;python_version>="3.6"
+       signxml: signxml
        signxml: defusedxml
        lxml: lxml
        defusedxml: defusedxml
@@ -16,8 +15,6 @@ commands = signxml: pytest
 setenv=
     PYTHONWARNINGS=all
     TZ=Europe/Amsterdam
-    py27,pypy: VIRTUALENV_SETUPTOOLS=43.0.0
-    py27,pypy: VIRTUALENV_PIP=19.3.1
 
 [testenv:flake8]
 skip_install = true

-----------------------------------------------------------------------

Summary of changes:
 .github/workflows/test.yml | 17 +----------------
 pskc/crypto/aeskw.py       |  7 ++-----
 pskc/encryption.py         |  6 +++---
 pskc/key.py                |  6 +++---
 pskc/serialiser.py         |  8 ++++----
 setup.py                   |  4 +---
 tox.ini                    |  7 ++-----
 7 files changed, 16 insertions(+), 39 deletions(-)


hooks/post-receive
-- 
python-pskc