Accepting request 850940 from devel:languages:python
- update to 2020.11.8: * Python 3.8+ support - Add two-basic-unit-tests.patch which includes two at least simple test patches (gh#certifi/python-certifi#137). OBS-URL: https://build.opensuse.org/request/show/850940 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-certifi?expand=0&rev=24
This commit is contained in:
commit
3633d944c9
3
certifi-2020.11.8.tar.gz
Normal file
3
certifi-2020.11.8.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f05def092c44fbf25834a51509ef6e631dc19765ab8a57b4e7ab85531f0a9cf4
|
||||
size 157338
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5930595817496dd21bb8dc35dad090f1c2cd0adfaf21204bf6732ca5d8ee34d3
|
||||
size 157997
|
@ -1,22 +1,30 @@
|
||||
diff -ur certifi-2020.6.20.o/certifi/core.py certifi-2020.6.20/certifi/core.py
|
||||
--- certifi-2020.6.20.o/certifi/core.py 2020-06-07 11:35:28.000000000 +0200
|
||||
+++ certifi-2020.6.20/certifi/core.py 2020-08-16 19:38:17.167625302 +0200
|
||||
@@ -5,56 +5,18 @@
|
||||
---
|
||||
certifi/core.py | 54 +++++++++---------------------------------------------
|
||||
1 file changed, 9 insertions(+), 45 deletions(-)
|
||||
|
||||
--- a/certifi/core.py
|
||||
+++ b/certifi/core.py
|
||||
@@ -1,60 +1,24 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
+import io
|
||||
|
||||
"""
|
||||
certifi.py
|
||||
~~~~~~~~~~
|
||||
|
||||
This module returns the installation location of cacert.pem or its contents.
|
||||
-"""
|
||||
+
|
||||
+Patched by openSUSE: return the system bundle
|
||||
"""
|
||||
-import os
|
||||
|
||||
-try:
|
||||
- from importlib.resources import path as get_path, read_text
|
||||
+Patched by openSUSE: return the system bundle
|
||||
+"""
|
||||
|
||||
- _CACERT_CTX = None
|
||||
- _CACERT_PATH = None
|
||||
+def read_text(_module=None, _path=None, encoding="ascii"):
|
||||
+ with open(where(), "r", encoding=encoding) as data:
|
||||
+ with io.open(where(), "r", encoding=encoding) as data:
|
||||
+ return data.read()
|
||||
|
||||
- def where():
|
||||
|
@ -1,3 +1,15 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Nov 26 09:21:35 UTC 2020 - Dirk Mueller <dmueller@suse.com>
|
||||
|
||||
- update to 2020.11.8:
|
||||
* Python 3.8+ support
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Nov 25 11:41:29 UTC 2020 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
- Add two-basic-unit-tests.patch which includes two at least simple test
|
||||
patches (gh#certifi/python-certifi#137).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Aug 16 17:45:09 UTC 2020 - Benjamin Greiner <code@bnavigator.de>
|
||||
|
||||
|
@ -18,17 +18,21 @@
|
||||
|
||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||
Name: python-certifi
|
||||
Version: 2020.6.20
|
||||
Version: 2020.11.8
|
||||
Release: 0
|
||||
Summary: Python package for providing Mozilla's CA Bundle
|
||||
License: MPL-2.0
|
||||
Group: Development/Languages/Python
|
||||
URL: https://github.com/certifi/python-certifi
|
||||
Source: https://files.pythonhosted.org/packages/source/c/certifi/certifi-%{version}.tar.gz
|
||||
# PATCH-FIX-SUSE -- prefer SUSE certificates (only for use on SUSE platforms)
|
||||
# PATCH-FIX-SUSE -- prefer SUSE certificates
|
||||
Patch0: python-certifi-shipped-requests-cabundle.patch
|
||||
# PATCH-FEATURE-UPSTREAM two-basic-unit-tests.patch gh#certifi/python-certifi#137 mcepl@suse.com
|
||||
# Add at least primitive test suite (by bnavigator)
|
||||
Patch1: two-basic-unit-tests.patch
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: ca-certificates
|
||||
BuildRequires: ca-certificates-mozilla
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: python-rpm-macros
|
||||
Requires: ca-certificates
|
||||
@ -44,10 +48,7 @@ identity of TLS hosts. It has been extracted from the Requests project.
|
||||
Note that on SUSE packages the used CA bundle is actually the system bundle
|
||||
|
||||
%prep
|
||||
%setup -q -n certifi-%{version}
|
||||
%if 0%{?suse_version}
|
||||
%patch0 -p1
|
||||
%endif
|
||||
%autosetup -p1 -n certifi-%{version}
|
||||
|
||||
%build
|
||||
%python_build
|
||||
@ -57,9 +58,7 @@ Note that on SUSE packages the used CA bundle is actually the system bundle
|
||||
|
||||
%{python_expand chmod +x %{buildroot}%{$python_sitelib}/certifi/core.py
|
||||
sed -i "s|#!%{_bindir}/env python|#!%__$python|" %{buildroot}/%{$python_sitelib}/certifi/core.py
|
||||
%if 0%{?suse_version}
|
||||
rm %{buildroot}%{$python_sitelib}/certifi/cacert.pem
|
||||
%endif
|
||||
}
|
||||
|
||||
%python_expand $python -m compileall %{buildroot}%{$python_sitelib}/certifi/
|
||||
@ -68,8 +67,7 @@ Note that on SUSE packages the used CA bundle is actually the system bundle
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||
|
||||
%check
|
||||
# There are no upstream unit tests https://github.com/certifi/python-certifi/issues/136
|
||||
# Please check that downstream packages like python-requests still build after an update of certifi
|
||||
%pyunittest -v certifi.tests.test_certifi
|
||||
|
||||
%files %{python_files}
|
||||
%license LICENSE
|
||||
|
83
two-basic-unit-tests.patch
Normal file
83
two-basic-unit-tests.patch
Normal file
@ -0,0 +1,83 @@
|
||||
From 7d617ff9dddee73bde86b79c9aa2f1c98f19e339 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Greiner <code@bnavigator.de>
|
||||
Date: Sun, 16 Aug 2020 20:17:39 +0200
|
||||
Subject: [PATCH 1/2] add 2 basic unit tests
|
||||
|
||||
---
|
||||
.github/workflows/python-package.yml | 40 +++++++++++++++++++++++++++++++++++
|
||||
certifi/tests/__init__.py | 2 +
|
||||
certifi/tests/test_certifi.py | 19 ++++++++++++++++
|
||||
3 files changed, 61 insertions(+)
|
||||
create mode 100644 certifi/tests/__init__.py
|
||||
create mode 100755 certifi/tests/test_certifi.py
|
||||
|
||||
--- /dev/null
|
||||
+++ b/certifi/tests/__init__.py
|
||||
@@ -0,0 +1,2 @@
|
||||
+# certifi.tests module
|
||||
+
|
||||
--- /dev/null
|
||||
+++ b/certifi/tests/test_certifi.py
|
||||
@@ -0,0 +1,19 @@
|
||||
+# -*- coding: utf-8 -*-
|
||||
+"""
|
||||
+unit tests to make sure everything behaves as expected
|
||||
+"""
|
||||
+
|
||||
+import os
|
||||
+import unittest
|
||||
+
|
||||
+import certifi
|
||||
+
|
||||
+
|
||||
+class TestCertifi(unittest.TestCase):
|
||||
+ def test_cabundle_exists(self):
|
||||
+ """Check that the reported bundle exists"""
|
||||
+ self.assertTrue(os.path.exists(certifi.where()))
|
||||
+
|
||||
+ def test_read_contents(self):
|
||||
+ """Check that the returned contents contain a certificate"""
|
||||
+ self.assertIn("-----BEGIN CERTIFICATE-----", certifi.contents())
|
||||
--- /dev/null
|
||||
+++ b/.github/workflows/python-package.yml
|
||||
@@ -0,0 +1,40 @@
|
||||
+# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
|
||||
+# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
|
||||
+
|
||||
+name: Python package
|
||||
+
|
||||
+on:
|
||||
+ push:
|
||||
+ branches: [ master ]
|
||||
+ pull_request:
|
||||
+ branches: [ master ]
|
||||
+
|
||||
+jobs:
|
||||
+ build:
|
||||
+
|
||||
+ runs-on: ubuntu-latest
|
||||
+ strategy:
|
||||
+ matrix:
|
||||
+ python-version: [3.5, 3.6, 3.7, 3.8]
|
||||
+
|
||||
+ steps:
|
||||
+ - uses: actions/checkout@v2
|
||||
+ - name: Set up Python ${{ matrix.python-version }}
|
||||
+ uses: actions/setup-python@v2
|
||||
+ with:
|
||||
+ python-version: ${{ matrix.python-version }}
|
||||
+ - name: Install test dependencies
|
||||
+ run: |
|
||||
+ python -m pip install --upgrade pip
|
||||
+ pip install pytest
|
||||
+ # pip install flake8 pytest
|
||||
+ # if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
||||
+ #- name: Lint with flake8
|
||||
+ # run: |
|
||||
+ # # stop the build if there are Python syntax errors or undefined names
|
||||
+ # flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||
+ # # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
||||
+ # flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
||||
+ - name: Test with pytest
|
||||
+ run: |
|
||||
+ pytest
|
Loading…
Reference in New Issue
Block a user