From bca25c9eceb8a21fb4765ca6ce03192e08ddbed0 Mon Sep 17 00:00:00 2001 From: Chris Caron Date: Sat, 6 Jul 2024 19:51:23 -0400 Subject: [PATCH] Dropped Python v3.6 (and EPEL8) support (#1155) --- .github/workflows/pkgbuild.yml | 2 +- .github/workflows/tests.yml | 4 -- Dockerfile.el8 | 64 ------------------- Dockerfile.el9 | 4 +- Dockerfile.py36 | 45 ------------- apprise/utils.py | 2 +- bin/README.md | 3 - docker-compose.yml | 19 ++---- packaging/README.md | 12 ++-- .../redhat/apprise-click67-support.patch | 39 ----------- .../redhat/apprise-no-macosx-testing.patch | 15 ----- ...pprise-pytest-session_mocker-removal.patch | 29 --------- packaging/redhat/python-apprise.spec | 46 ------------- requirements.txt | 5 +- setup.py | 1 - 15 files changed, 16 insertions(+), 274 deletions(-) delete mode 100644 Dockerfile.el8 delete mode 100644 Dockerfile.py36 delete mode 100644 packaging/redhat/apprise-click67-support.patch delete mode 100644 packaging/redhat/apprise-no-macosx-testing.patch delete mode 100644 packaging/redhat/apprise-pytest-session_mocker-removal.patch diff --git a/.github/workflows/pkgbuild.yml b/.github/workflows/pkgbuild.yml index 49d62f3b..2ff5f060 100644 --- a/.github/workflows/pkgbuild.yml +++ b/.github/workflows/pkgbuild.yml @@ -38,7 +38,7 @@ jobs: # items within the `services` section of `docker-compose.yml`. matrix: target: [ - "rpmbuild.el8", + "rpmbuild.el9", ] defaults: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 917fd56b..ed320b8f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -49,10 +49,6 @@ jobs: python-version: "3.11" # Test more available versions of CPython on Linux. - - os: "ubuntu-20.04" - # v3.6 (exclusively referenced) is not supported by GitHub anymore) - # v3.6.8 is fixed since it is the version CentOS/Rocky/RedHat v8 uses - python-version: "3.6.8" - os: "ubuntu-latest" python-version: "3.7" - os: "ubuntu-latest" diff --git a/Dockerfile.el8 b/Dockerfile.el8 deleted file mode 100644 index 5725107c..00000000 --- a/Dockerfile.el8 +++ /dev/null @@ -1,64 +0,0 @@ -# -*- coding: utf-8 -*- -# BSD 2-Clause License -# -# Apprise - Push Notification Library. -# Copyright (c) 2024, Chris Caron -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - -# Base -FROM rockylinux:8 -ENV container docker -RUN ( \ - cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \ - systemd-tmpfiles-setup.service ] || rm -f $i; done); \ - rm -f /lib/systemd/system/multi-user.target.wants/*;\ - rm -f /etc/systemd/system/*.wants/*;\ - rm -f /lib/systemd/system/local-fs.target.wants/*; \ - rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ - rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ - rm -f /lib/systemd/system/basic.target.wants/*;\ - rm -f /lib/systemd/system/anaconda.target.wants/*; \ - echo "assumeyes=1" >> /etc/yum.conf; \ - dnf install -y epel-release; \ - dnf install -y rpm-build rpmlint python3-pip python3-virtualenv rubygem-ronn \ - dnf-plugins-core 'dnf-command(config-manager)' \ - 'dnf-command(builddep)' sudo rsync rpmdevtools; \ - dnf config-manager --set-enabled powertools; - -COPY packaging/redhat/python-apprise.spec / -# Place our build file into the path -COPY bin/build-rpm.sh /usr/bin -RUN rpmspec -q --buildrequires /python-apprise.spec | cut -f1 -d' ' | \ - xargs dnf install -y - -# RPM Build Structure Setup -ENV FLAVOR=rpmbuild OS=centos DIST=el8 -RUN useradd builder -u 1000 -m -G users,wheel &>/dev/null && \ - echo "builder ALL=(ALL:ALL) NOPASSWD:ALL" >> /etc/sudoers - -VOLUME ["/apprise"] -WORKDIR /apprise - -# RPMs should never be built as root -USER builder diff --git a/Dockerfile.el9 b/Dockerfile.el9 index 16dd3992..08700ba4 100644 --- a/Dockerfile.el9 +++ b/Dockerfile.el9 @@ -29,9 +29,7 @@ # Base FROM rockylinux:9 ENV container docker -RUN ( \ - cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \ - systemd-tmpfiles-setup.service ] || rm -f $i; done); \ +RUN \ rm -f /lib/systemd/system/multi-user.target.wants/*;\ rm -f /etc/systemd/system/*.wants/*;\ rm -f /lib/systemd/system/local-fs.target.wants/*; \ diff --git a/Dockerfile.py36 b/Dockerfile.py36 deleted file mode 100644 index 736a3c21..00000000 --- a/Dockerfile.py36 +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -# BSD 2-Clause License -# -# Apprise - Push Notification Library. -# Copyright (c) 2024, Chris Caron -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - -# Base -FROM python:3.6-buster -RUN apt-get update && \ - apt-get install -y --no-install-recommends libdbus-1-dev libgirepository1.0-dev build-essential musl-dev bash dbus && \ - rm -rf /var/lib/apt/lists/* -RUN pip install --no-cache-dir dbus-python PyGObject - -# Apprise Setup -VOLUME ["/apprise"] -WORKDIR /apprise -COPY requirements.txt / -COPY dev-requirements.txt / -ENV PYTHONPATH /apprise -ENV PYTHONPYCACHEPREFIX /apprise/__pycache__/py36 - - -RUN pip install --no-cache-dir -r /requirements.txt -r /dev-requirements.txt diff --git a/apprise/utils.py b/apprise/utils.py index b33ec074..fd7f743a 100644 --- a/apprise/utils.py +++ b/apprise/utils.py @@ -1523,7 +1523,7 @@ def environ(*remove, **update): locale.setlocale(locale.LC_ALL, loc_orig) except locale.Error: - # Thrown in py3.6 + # Handle this case pass diff --git a/bin/README.md b/bin/README.md index 6d845adc..9dfbce0a 100644 --- a/bin/README.md +++ b/bin/README.md @@ -52,9 +52,6 @@ export PATH="$(pwd)/bin:$PATH" Apprise is also packaged for Redhat/Fedora as an RPM. To verify this processs works correctly an additional tool called `build-rpm.sh` is provided. It's best tested using the Docker environments: ```bash - # To test with el8; do the following: - docker-compose run --rm rpmbuild.el8 build-rpm.sh - # To test with el9; do the following: docker-compose run --rm rpmbuild.el9 build-rpm.sh diff --git a/docker-compose.yml b/docker-compose.yml index 74236336..a23865e2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,12 +1,5 @@ version: "3.3" services: - test.py36: - build: - context: . - dockerfile: Dockerfile.py36 - volumes: - - ./:/apprise - test.py310: build: context: . @@ -75,20 +68,20 @@ services: # Other Testing # # Connect to web and create a new project using the manage script -# -> docker-compose run --rm test.py36 bash +# -> docker-compose run --rm test.py311 bash # bin/apprise - # bin/checkdone.sh # # Run a set of tests for just a certain section -# docker-compose run --rm test.py36 bin/test.sh fcm +# docker-compose run --rm test.py311 bin/test.sh fcm # -# Or just run all the tests in python 3.6 -# docker-compose run --rm test.py36 bin/test.sh +# Or just run all the tests in python 3.11 +# docker-compose run --rm test.py311 bin/test.sh # # Want to run the whole test suite: # # [ -f .coverage ] && rm -f .coverage -# docker-compose run --rm test.py36 coverage run --append -m pytest -vv +# docker-compose run --rm test.py311 coverage run --append -m pytest -vv # docker-compose run --rm test.py310 coverage run --append -m pytest -vv # # # Now produce a report @@ -98,8 +91,6 @@ services: # RPM Building # -# el8 -# - docker-compose run --rm rpmbuild.el8 build-rpm.sh # el9 # - docker-compose run --rm rpmbuild.el9 build-rpm.sh # f39 (Fedora) diff --git a/packaging/README.md b/packaging/README.md index 85a7970d..c7c5339e 100644 --- a/packaging/README.md +++ b/packaging/README.md @@ -2,12 +2,12 @@ This directory contains any supporting files to grant usage of Apprise in various distributions. ### RPM Based Packages -* [EPEL](https://fedoraproject.org/wiki/EPEL) based distributions are only supported if they are of v8 or higher. This includes: - * Red Hat 8.x (or higher) - * Scientific OS 8.x (or higher) - * Oracle Linux 8.x (or higher) - * Rocky Linux 8.x (or higher) - * Alma Linux 8.x (or higher) +* [EPEL](https://fedoraproject.org/wiki/EPEL) based distributions are only supported if they are of v9 or higher. This includes: + * Red Hat 9.x (or higher) + * Scientific OS 9.x (or higher) + * Oracle Linux 9.x (or higher) + * Rocky Linux 9.x (or higher) + * Alma Linux 9.x (or higher) * Fedora 29 (or higher) Provided you are connected to the [EPEL repositories](https://fedoraproject.org/wiki/EPEL), the following will just work for you: diff --git a/packaging/redhat/apprise-click67-support.patch b/packaging/redhat/apprise-click67-support.patch deleted file mode 100644 index 3a52487b..00000000 --- a/packaging/redhat/apprise-click67-support.patch +++ /dev/null @@ -1,39 +0,0 @@ -diff -Naur apprise-1.4.5/test/test_apprise_cli.py apprise-1.4.5-patched/test/test_apprise_cli.py ---- apprise-1.4.5/test/test_apprise_cli.py 2023-08-20 11:26:43.000000000 -0400 -+++ apprise-1.4.5-patched/test/test_apprise_cli.py 2023-08-20 16:37:42.922342103 -0400 -@@ -1027,9 +1027,6 @@ - # Absolute path to __init__.py is okay - assert result.exit_code == 0 - -- # we can verify that it prepares our message -- assert result.stdout.strip() == 'info: - test body' -- - # Clear our working variables so they don't obstruct the next test - # This simulates an actual call from the CLI. Unfortunately through - # testing were occupying the same memory space so our singleton's -@@ -1049,9 +1046,6 @@ - # an __init__.py is found on the inside of it - assert result.exit_code == 0 - -- # we can verify that it prepares our message -- assert result.stdout.strip() == 'info: - test body' -- - # Test double paths that are the same; this ensures we only - # load the plugin once - result = runner.invoke(cli.main, [ -@@ -1183,15 +1177,6 @@ - # Print our custom details to the screen - '--details', - ]) -- assert 'willfail' in result.stdout -- assert 'always failing...' in result.stdout -- -- assert 'clihook1' in result.stdout -- assert 'the original clihook entry' in result.stdout -- assert 'a duplicate of the clihook entry' not in result.stdout -- -- assert 'clihook2' in result.stdout -- assert 'Custom - clihook2' in result.stdout - - # Note that the failure of the decorator carries all the way back - # to the CLI diff --git a/packaging/redhat/apprise-no-macosx-testing.patch b/packaging/redhat/apprise-no-macosx-testing.patch deleted file mode 100644 index 40d1a394..00000000 --- a/packaging/redhat/apprise-no-macosx-testing.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff -Naur apprise-1.6.0/test/test_plugin_macosx.py apprise-1.6.0.patched/test/test_plugin_macosx.py ---- apprise-1.6.0/test/test_plugin_macosx.py 2023-12-22 16:51:24.000000000 -0500 -+++ apprise-1.6.0.patched/test/test_plugin_macosx.py 2023-12-22 17:38:35.720131819 -0500 -@@ -42,9 +42,8 @@ - logging.disable(logging.CRITICAL) - - --if sys.platform not in ["darwin", "linux"]: -- pytest.skip("Only makes sense on macOS, but testable in Linux", -- allow_module_level=True) -+if sys.platform != "darwin": -+ pytest.skip("MacOS test only", allow_module_level=True) - - - @pytest.fixture diff --git a/packaging/redhat/apprise-pytest-session_mocker-removal.patch b/packaging/redhat/apprise-pytest-session_mocker-removal.patch deleted file mode 100644 index 60557e27..00000000 --- a/packaging/redhat/apprise-pytest-session_mocker-removal.patch +++ /dev/null @@ -1,29 +0,0 @@ -diff -Naur apprise-1.8.0/test/conftest.py apprise-1.8.0-patched/test/conftest.py ---- apprise-1.8.0/test/conftest.py 2024-06-01 21:28:32.102470720 -0400 -+++ apprise-1.8.0-patched/test/conftest.py 2024-06-01 21:29:32.363754277 -0400 -@@ -46,7 +46,7 @@ - A_MGR = AttachmentManager() - - --@pytest.fixture(scope="function", autouse=True) -+@pytest.fixture(autouse=True) - def mimetypes_always_available(): - """ - A pytest session fixture which ensures mimetypes is set correctly -@@ -56,8 +56,8 @@ - mimetypes.init(files=files) - - --@pytest.fixture(scope="function", autouse=True) --def no_throttling_everywhere(session_mocker): -+@pytest.fixture(autouse=True) -+def no_throttling_everywhere(mocker): - """ - A pytest session fixture which disables throttling on all notifiers. - It is automatically enabled. -@@ -68,4 +68,4 @@ - A_MGR.unload_modules() - - for plugin in N_MGR.plugins(): -- session_mocker.patch.object(plugin, "request_rate_per_sec", 0) -+ mocker.patch.object(plugin, "request_rate_per_sec", 0) diff --git a/packaging/redhat/python-apprise.spec b/packaging/redhat/python-apprise.spec index a801dee3..e8c3abb8 100644 --- a/packaging/redhat/python-apprise.spec +++ b/packaging/redhat/python-apprise.spec @@ -61,25 +61,6 @@ Summary: A simple wrapper to many popular notification services used toda License: BSD URL: https://github.com/caronc/%{pypi_name} Source0: %{url}/archive/v%{version}/%{pypi_name}-%{version}.tar.gz - -# RHEL/Rocky 8 ship with Click v6.7 which does not support the .stdout -# directive used in the unit testing. This patch just makes it so our package -# continues to be compatible with these linux distributions -Patch0: %{pypi_name}-click67-support.patch - -# RHEL/Rocky 8 ship with Pytest v3.4.2 which does not support the -# session_mocker fixture. This patch removes the session_mocker -# Patch thanks to Andreas Motl and his PR: -# - https://github.com/caronc/apprise/pull/763 -Patch1: %{pypi_name}-pytest-session_mocker-removal.patch - -# RHEL/Rocky 8 ship with Pytest v3.4.2 which does not support the -# tmp_path fixture. This patch removes the macos testing as it -# leverages this unavailabe fixture. -# At the end of the day, the macos testing it is not needed by a -# RHEL/Fedora environment anyway for obvious reasons. -Patch2: %{pypi_name}-no-macosx-testing.patch - BuildArch: noarch %description %{common_description} @@ -119,18 +100,7 @@ Requires: python%{python3_pkgversion}-certifi Requires: python%{python3_pkgversion}-yaml Recommends: python%{python3_pkgversion}-paho-mqtt -%if 0%{?rhel} && 0%{?rhel} <= 8 -BuildRequires: python%{python3_pkgversion}-dataclasses -Requires: python%{python3_pkgversion}-dataclasses -%endif - %if %{with tests} -%if 0%{?rhel} >= 9 -# Do not import python3-mock -%else -# python-mock switched to unittest.mock -BuildRequires: python%{python3_pkgversion}-mock -%endif BuildRequires: python%{python3_pkgversion}-pytest BuildRequires: python%{python3_pkgversion}-pytest-mock BuildRequires: python%{python3_pkgversion}-pytest-runner @@ -142,14 +112,6 @@ BuildRequires: python%{python3_pkgversion}-pytest-xdist %prep %setup -q -n %{pypi_name}-%{version} -%if 0%{?rhel} && 0%{?rhel} <= 8 -# Rocky/RHEL 8 click v6.7 unit testing support -%patch0 -p1 -# Rocky/RHEL 8 Drop session_mocker support -%patch1 -p1 -# Rocky/RHEL 8 Lose MacOSX Testing -%patch2 -p1 -%endif # 2023.08.27: This test fails for some uknown reason only during the test # section of this RPM, but works completley fine under all other circumstances. @@ -161,14 +123,6 @@ BuildRequires: python%{python3_pkgversion}-pytest-xdist # at this time; remove failing test until this is resolved %{__rm} test/test_apprise_translations.py -%if 0%{?rhel} >= 9 -# Do nothing -%else -# CentOS 8.x requires python-mock (cororlates with import ab)ve -find test -type f -name '*.py' -exec \ - sed -i -e 's|^from unittest import mock|import mock|g' {} \; -%endif - %build %py3_build diff --git a/requirements.txt b/requirements.txt index 5fa813d2..7d3b570d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,7 @@ -# Root certificate authority bundle. +# Root certificate authority bundle certifi -# Application dependencies. -dataclasses; python_version<"3.7" +# Application dependencies requests requests-oauthlib click >= 5.0 diff --git a/setup.py b/setup.py index 91a5ec7d..4088e0ef 100755 --- a/setup.py +++ b/setup.py @@ -94,7 +94,6 @@ setup( 'Natural Language :: English', 'Programming Language :: Python', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9',