]> git.ipfire.org Git - pakfire.git/commitdiff
constants: Export PAKFIRE_DIGEST_* to Python
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 15 Jul 2022 15:51:21 +0000 (15:51 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 15 Jul 2022 15:51:21 +0000 (15:51 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/_pakfire/_pakfiremodule.c
src/pakfire/constants.py

index cdbedc41e0abedc0e4d40309f9a81bcbc65b35aa..dd41217edb07486fe54576a7a7ced07dd3fbcb9e 100644 (file)
@@ -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;
index 7ec637ea08f7e07e1dc372e50ff8b356d384e226..8c018892152aeb5ef765a25b7ec49a842fcd8738 100644 (file)
@@ -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/"