Skip to content

Commit 163289b

Browse files
authored
Merge pull request #3015 from Dentrax/py3-certifi
Add py3-certifi
2 parents d6685e9 + 48380a7 commit 163289b

3 files changed

Lines changed: 113 additions & 0 deletions

File tree

packages.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ py3-docutils
102102
py3-pygments
103103
py3-magic
104104
py3-babel
105+
py3-certifi
105106
libedit
106107
tiff
107108
pcre2

py3-certifi.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package:
2+
name: py3-certifi
3+
version: 2023.5.7
4+
epoch: 0
5+
description: "Python3 package for providing Mozilla's CA Bundle"
6+
copyright:
7+
- license: MPL-2.0
8+
dependencies:
9+
runtime:
10+
- python3
11+
- ca-certificates-bundle
12+
13+
environment:
14+
contents:
15+
packages:
16+
- wolfi-base
17+
- busybox
18+
- ca-certificates-bundle
19+
- build-base
20+
- python3
21+
- py3-setuptools
22+
23+
pipeline:
24+
- uses: fetch
25+
with:
26+
uri: https://files.pythonhosted.org/packages/source/c/certifi/certifi-${{package.version}}.tar.gz
27+
expected-sha256: 0f0d56dc5a6ad56fd4ba36484d6cc34451e1c6548c61daad8c320169f91eddc7
28+
29+
- uses: patch
30+
with:
31+
patches: use-alpine-system-certs.patch
32+
33+
- runs: |
34+
python3 setup.py build
35+
36+
- runs: |
37+
python3 setup.py install --prefix=/usr --root="${{targets.destdir}}"
38+
39+
- uses: strip
40+
41+
update:
42+
enabled: true
43+
release-monitor:
44+
identifier: 7995
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# originated from https://git.alpinelinux.org/aports/tree/main/py3-certifi/use-alpine-system-certs.patch
2+
3+
NEVER EVER REMOVE THIS PATCH
4+
REBASE IT ON TOP OF THE VERSION YOU'RE UPGRADING
5+
6+
This makes py3-certifi use the system certificates provided by Alpine Linux
7+
instead of the ones provided with py3-certifi instead, this allows us to add
8+
this package as a dependency for other packages without worries.
9+
10+
This is based on the patch used by Debian
11+
12+
diff --git a/certifi/core.py b/certifi/core.py
13+
index de02898..9c0235f 100644
14+
--- a/certifi/core.py
15+
+++ b/certifi/core.py
16+
@@ -6,13 +6,13 @@ This module returns the installation location of cacert.pem or its contents.
17+
"""
18+
import sys
19+
20+
+ALPINE_CA_CERTS_PATH = '/etc/ssl/certs/ca-certificates.crt'
21+
22+
if sys.version_info >= (3, 11):
23+
24+
from importlib.resources import as_file, files
25+
26+
- _CACERT_CTX = None
27+
- _CACERT_PATH = None
28+
+ _CACERT_PATH = ALPINE_CA_CERTS_PATH
29+
30+
def where() -> str:
31+
# This is slightly terrible, but we want to delay extracting the file
32+
@@ -45,8 +45,7 @@ elif sys.version_info >= (3, 7):
33+
34+
from importlib.resources import path as get_path, read_text
35+
36+
- _CACERT_CTX = None
37+
- _CACERT_PATH = None
38+
+ _CACERT_PATH = ALPINE_CA_CERTS_PATH
39+
40+
def where() -> str:
41+
# This is slightly terrible, but we want to delay extracting the
42+
@@ -71,10 +70,11 @@ elif sys.version_info >= (3, 7):
43+
_CACERT_CTX = get_path("certifi", "cacert.pem")
44+
_CACERT_PATH = str(_CACERT_CTX.__enter__())
45+
46+
- return _CACERT_PATH
47+
+ return ALPINE_CA_CERTS_PATH
48+
49+
def contents() -> str:
50+
- return read_text("certifi", "cacert.pem", encoding="ascii")
51+
+ with open(where(), "r", encoding="ascii") as data:
52+
+ return data.read()
53+
54+
else:
55+
import os
56+
@@ -100,9 +100,7 @@ else:
57+
# If we don't have importlib.resources, then we will just do the old logic
58+
# of assuming we're on the filesystem and munge the path directly.
59+
def where() -> str:
60+
- f = os.path.dirname(__file__)
61+
-
62+
- return os.path.join(f, "cacert.pem")
63+
-
64+
+ return ALPINE_CA_CERTS_PATH
65+
def contents() -> str:
66+
- return read_text("certifi", "cacert.pem", encoding="ascii")
67+
+ with open(where(), "r", encoding="ascii") as data:
68+
+ return data.read()

0 commit comments

Comments
 (0)