python3-certifi: use system cacert
This commit is contained in:
parent
71bba0f826
commit
6eba187340
|
@ -0,0 +1,53 @@
|
||||||
|
--- a/certifi/core.py
|
||||||
|
+++ b/certifi/core.py
|
||||||
|
@@ -10,36 +10,15 @@ import sys
|
||||||
|
if sys.version_info >= (3, 11):
|
||||||
|
|
||||||
|
from importlib.resources import as_file, files
|
||||||
|
+ from pathlib import Path
|
||||||
|
|
||||||
|
- _CACERT_CTX = None
|
||||||
|
- _CACERT_PATH = None
|
||||||
|
+ _CACERT_PATH = '/etc/ssl/certs.pem'
|
||||||
|
|
||||||
|
def where() -> str:
|
||||||
|
- # This is slightly terrible, but we want to delay extracting the file
|
||||||
|
- # in cases where we're inside of a zipimport situation until someone
|
||||||
|
- # actually calls where(), but we don't want to re-extract the file
|
||||||
|
- # on every call of where(), so we'll do it once then store it in a
|
||||||
|
- # global variable.
|
||||||
|
- global _CACERT_CTX
|
||||||
|
- global _CACERT_PATH
|
||||||
|
- if _CACERT_PATH is None:
|
||||||
|
- # This is slightly janky, the importlib.resources API wants you to
|
||||||
|
- # manage the cleanup of this file, so it doesn't actually return a
|
||||||
|
- # path, it returns a context manager that will give you the path
|
||||||
|
- # when you enter it and will do any cleanup when you leave it. In
|
||||||
|
- # the common case of not needing a temporary file, it will just
|
||||||
|
- # return the file system location and the __exit__() is a no-op.
|
||||||
|
- #
|
||||||
|
- # We also have to hold onto the actual context manager, because
|
||||||
|
- # it will do the cleanup whenever it gets garbage collected, so
|
||||||
|
- # we will also store that at the global level as well.
|
||||||
|
- _CACERT_CTX = as_file(files("certifi").joinpath("cacert.pem"))
|
||||||
|
- _CACERT_PATH = str(_CACERT_CTX.__enter__())
|
||||||
|
-
|
||||||
|
return _CACERT_PATH
|
||||||
|
|
||||||
|
def contents() -> str:
|
||||||
|
- return files("certifi").joinpath("cacert.pem").read_text(encoding="ascii")
|
||||||
|
+ return Path(_CACERT_PATH).read_text(encoding="ascii")
|
||||||
|
|
||||||
|
elif sys.version_info >= (3, 7):
|
||||||
|
|
||||||
|
--- a/setup.py
|
||||||
|
+++ b/setup.py
|
||||||
|
@@ -41,7 +41,7 @@ setup(
|
||||||
|
'certifi',
|
||||||
|
],
|
||||||
|
package_dir={'certifi': 'certifi'},
|
||||||
|
- package_data={'certifi': ['*.pem', 'py.typed']},
|
||||||
|
+ package_data={'certifi': ['py.typed']},
|
||||||
|
# data_files=[('certifi', ['certifi/cacert.pem'])],
|
||||||
|
include_package_data=True,
|
||||||
|
zip_safe=False,
|
|
@ -1,7 +1,7 @@
|
||||||
# Template file for 'python3-certifi'
|
# Template file for 'python3-certifi'
|
||||||
pkgname=python3-certifi
|
pkgname=python3-certifi
|
||||||
version=2022.09.24
|
version=2022.09.24
|
||||||
revision=2
|
revision=3
|
||||||
build_style=python3-module
|
build_style=python3-module
|
||||||
hostmakedepends="python3-setuptools"
|
hostmakedepends="python3-setuptools"
|
||||||
depends="python3"
|
depends="python3"
|
||||||
|
@ -12,7 +12,10 @@ homepage="https://certifi.io"
|
||||||
distfiles="https://github.com/certifi/python-certifi/archive/${version}.tar.gz"
|
distfiles="https://github.com/certifi/python-certifi/archive/${version}.tar.gz"
|
||||||
checksum=8c1db7f2a3b272e8a90b2e1910763930fa81e2512fbb96cb7a25787d63765c78
|
checksum=8c1db7f2a3b272e8a90b2e1910763930fa81e2512fbb96cb7a25787d63765c78
|
||||||
|
|
||||||
do_check() {
|
post_extract() {
|
||||||
cd build/lib
|
rm -f certifi/cacert.pem
|
||||||
python3 -c 'import certifi as m; print(m)'
|
}
|
||||||
|
|
||||||
|
do_check() {
|
||||||
|
python3 -m unittest
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue