From: Michael Tremer Date: Fri, 15 Jul 2022 15:51:21 +0000 (+0000) Subject: constants: Export PAKFIRE_DIGEST_* to Python X-Git-Tag: 0.9.28~707 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7911a2e3d0414309da13aac103c51f6f6f698936;p=pakfire.git constants: Export PAKFIRE_DIGEST_* to Python Signed-off-by: Michael Tremer --- diff --git a/src/_pakfire/_pakfiremodule.c b/src/_pakfire/_pakfiremodule.c index cdbedc41e..dd41217ed 100644 --- a/src/_pakfire/_pakfiremodule.c +++ b/src/_pakfire/_pakfiremodule.c @@ -85,6 +85,14 @@ PyMODINIT_FUNC PyInit__pakfire(void) { Py_INCREF(PyExc_DependencyError); PyModule_AddObject(module, "DependencyError", PyExc_DependencyError); + // Add digest constants + if (PyModule_AddIntMacro(module, PAKFIRE_DIGEST_SHA512)) + return NULL; + if (PyModule_AddIntMacro(module, PAKFIRE_DIGEST_SHA256)) + return NULL; + if (PyModule_AddIntMacro(module, PAKFIRE_DIGEST_SHA1)) + return NULL; + // Pakfire if (PyType_Ready(&PakfireType) < 0) return NULL; diff --git a/src/pakfire/constants.py b/src/pakfire/constants.py index 7ec637ea0..8c0188921 100644 --- a/src/pakfire/constants.py +++ b/src/pakfire/constants.py @@ -25,6 +25,13 @@ from .errors import * from .__version__ import PAKFIRE_VERSION +# Fetch digest constants +from ._pakfire import ( + PAKFIRE_DIGEST_SHA512, + PAKFIRE_DIGEST_SHA256, + PAKFIRE_DIGEST_SHA1, +) + # The default hub to connect to. PAKFIRE_HUB = "https://pakfirehub.ipfire.org/"