Browse Source

Dropped Python v3.6 (and EPEL8) support (#1155)

pull/1160/head
Chris Caron 5 months ago committed by GitHub
parent
commit
bca25c9ece
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      .github/workflows/pkgbuild.yml
  2. 4
      .github/workflows/tests.yml
  3. 64
      Dockerfile.el8
  4. 4
      Dockerfile.el9
  5. 45
      Dockerfile.py36
  6. 2
      apprise/utils.py
  7. 3
      bin/README.md
  8. 19
      docker-compose.yml
  9. 12
      packaging/README.md
  10. 39
      packaging/redhat/apprise-click67-support.patch
  11. 15
      packaging/redhat/apprise-no-macosx-testing.patch
  12. 29
      packaging/redhat/apprise-pytest-session_mocker-removal.patch
  13. 46
      packaging/redhat/python-apprise.spec
  14. 5
      requirements.txt
  15. 1
      setup.py

2
.github/workflows/pkgbuild.yml

@ -38,7 +38,7 @@ jobs:
# items within the `services` section of `docker-compose.yml`. # items within the `services` section of `docker-compose.yml`.
matrix: matrix:
target: [ target: [
"rpmbuild.el8", "rpmbuild.el9",
] ]
defaults: defaults:

4
.github/workflows/tests.yml

@ -49,10 +49,6 @@ jobs:
python-version: "3.11" python-version: "3.11"
# Test more available versions of CPython on Linux. # 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" - os: "ubuntu-latest"
python-version: "3.7" python-version: "3.7"
- os: "ubuntu-latest" - os: "ubuntu-latest"

64
Dockerfile.el8

@ -1,64 +0,0 @@
# -*- coding: utf-8 -*-
# BSD 2-Clause License
#
# Apprise - Push Notification Library.
# Copyright (c) 2024, Chris Caron <lead2gold@gmail.com>
#
# 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

4
Dockerfile.el9

@ -29,9 +29,7 @@
# Base # Base
FROM rockylinux:9 FROM rockylinux:9
ENV container docker ENV container docker
RUN ( \ 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 /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\ rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \ rm -f /lib/systemd/system/local-fs.target.wants/*; \

45
Dockerfile.py36

@ -1,45 +0,0 @@
# -*- coding: utf-8 -*-
# BSD 2-Clause License
#
# Apprise - Push Notification Library.
# Copyright (c) 2024, Chris Caron <lead2gold@gmail.com>
#
# 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

2
apprise/utils.py

@ -1523,7 +1523,7 @@ def environ(*remove, **update):
locale.setlocale(locale.LC_ALL, loc_orig) locale.setlocale(locale.LC_ALL, loc_orig)
except locale.Error: except locale.Error:
# Thrown in py3.6 # Handle this case
pass pass

3
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: 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 ```bash
# To test with el8; do the following:
docker-compose run --rm rpmbuild.el8 build-rpm.sh
# To test with el9; do the following: # To test with el9; do the following:
docker-compose run --rm rpmbuild.el9 build-rpm.sh docker-compose run --rm rpmbuild.el9 build-rpm.sh

19
docker-compose.yml

@ -1,12 +1,5 @@
version: "3.3" version: "3.3"
services: services:
test.py36:
build:
context: .
dockerfile: Dockerfile.py36
volumes:
- ./:/apprise
test.py310: test.py310:
build: build:
context: . context: .
@ -75,20 +68,20 @@ services:
# Other Testing # Other Testing
# #
# Connect to web and create a new project using the manage script # 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/apprise -
# bin/checkdone.sh # bin/checkdone.sh
# #
# Run a set of tests for just a certain section # 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 # Or just run all the tests in python 3.11
# docker-compose run --rm test.py36 bin/test.sh # docker-compose run --rm test.py311 bin/test.sh
# #
# Want to run the whole test suite: # Want to run the whole test suite:
# #
# [ -f .coverage ] && rm -f .coverage # [ -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 # docker-compose run --rm test.py310 coverage run --append -m pytest -vv
# #
# # Now produce a report # # Now produce a report
@ -98,8 +91,6 @@ services:
# RPM Building # RPM Building
# #
# el8
# - docker-compose run --rm rpmbuild.el8 build-rpm.sh
# el9 # el9
# - docker-compose run --rm rpmbuild.el9 build-rpm.sh # - docker-compose run --rm rpmbuild.el9 build-rpm.sh
# f39 (Fedora) # f39 (Fedora)

12
packaging/README.md

@ -2,12 +2,12 @@
This directory contains any supporting files to grant usage of Apprise in various distributions. This directory contains any supporting files to grant usage of Apprise in various distributions.
### RPM Based Packages ### RPM Based Packages
* [EPEL](https://fedoraproject.org/wiki/EPEL) based distributions are only supported if they are of v8 or higher. This includes: * [EPEL](https://fedoraproject.org/wiki/EPEL) based distributions are only supported if they are of v9 or higher. This includes:
* Red Hat 8.x (or higher) * Red Hat 9.x (or higher)
* Scientific OS 8.x (or higher) * Scientific OS 9.x (or higher)
* Oracle Linux 8.x (or higher) * Oracle Linux 9.x (or higher)
* Rocky Linux 8.x (or higher) * Rocky Linux 9.x (or higher)
* Alma Linux 8.x (or higher) * Alma Linux 9.x (or higher)
* Fedora 29 (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: Provided you are connected to the [EPEL repositories](https://fedoraproject.org/wiki/EPEL), the following will just work for you:

39
packaging/redhat/apprise-click67-support.patch

@ -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

15
packaging/redhat/apprise-no-macosx-testing.patch

@ -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

29
packaging/redhat/apprise-pytest-session_mocker-removal.patch

@ -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)

46
packaging/redhat/python-apprise.spec

@ -61,25 +61,6 @@ Summary: A simple wrapper to many popular notification services used toda
License: BSD License: BSD
URL: https://github.com/caronc/%{pypi_name} URL: https://github.com/caronc/%{pypi_name}
Source0: %{url}/archive/v%{version}/%{pypi_name}-%{version}.tar.gz 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 BuildArch: noarch
%description %{common_description} %description %{common_description}
@ -119,18 +100,7 @@ Requires: python%{python3_pkgversion}-certifi
Requires: python%{python3_pkgversion}-yaml Requires: python%{python3_pkgversion}-yaml
Recommends: python%{python3_pkgversion}-paho-mqtt 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 %{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
BuildRequires: python%{python3_pkgversion}-pytest-mock BuildRequires: python%{python3_pkgversion}-pytest-mock
BuildRequires: python%{python3_pkgversion}-pytest-runner BuildRequires: python%{python3_pkgversion}-pytest-runner
@ -142,14 +112,6 @@ BuildRequires: python%{python3_pkgversion}-pytest-xdist
%prep %prep
%setup -q -n %{pypi_name}-%{version} %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 # 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. # 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 # at this time; remove failing test until this is resolved
%{__rm} test/test_apprise_translations.py %{__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 %build
%py3_build %py3_build

5
requirements.txt

@ -1,8 +1,7 @@
# Root certificate authority bundle. # Root certificate authority bundle
certifi certifi
# Application dependencies. # Application dependencies
dataclasses; python_version<"3.7"
requests requests
requests-oauthlib requests-oauthlib
click >= 5.0 click >= 5.0

1
setup.py

@ -94,7 +94,6 @@ setup(
'Natural Language :: English', 'Natural Language :: English',
'Programming Language :: Python', 'Programming Language :: Python',
'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.9',

Loading…
Cancel
Save