From 6fae15dbdb02f09834d66e389075bda0ad899704 Mon Sep 17 00:00:00 2001 From: Tomas Mlcoch Date: Wed, 12 Jun 2013 15:49:25 +0200 Subject: [PATCH] python: Add cr.UNKNOWN_CHECKSUM constant. --- src/python/__init__.py | 16 +++++++++------- src/python/createrepo_cmodule.c | 1 + tests/python/tests/test_checksum.py | 2 ++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/python/__init__.py b/src/python/__init__.py index 660edba..3952542 100644 --- a/src/python/__init__.py +++ b/src/python/__init__.py @@ -8,13 +8,15 @@ VERSION_MINOR = _createrepo_c.VERSION_MINOR VERSION_PATCH = _createrepo_c.VERSION_PATCH VERSION = u"%d.%d.%d" % (VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH) -MD5 = _createrepo_c.MD5 -SHA = _createrepo_c.SHA -SHA1 = _createrepo_c.SHA1 -SHA224 = _createrepo_c.SHA224 -SHA256 = _createrepo_c.SHA256 -SHA384 = _createrepo_c.SHA384 -SHA512 = _createrepo_c.SHA512 +UNKNOWN_CHECKSUM = _createrepo_c.CHECKSUM_UNKNOWN +CHECKSUM_UNKNOWN = _createrepo_c.CHECKSUM_UNKNOWN +MD5 = _createrepo_c.MD5 +SHA = _createrepo_c.SHA +SHA1 = _createrepo_c.SHA1 +SHA224 = _createrepo_c.SHA224 +SHA256 = _createrepo_c.SHA256 +SHA384 = _createrepo_c.SHA384 +SHA512 = _createrepo_c.SHA512 AUTO_DETECT_COMPRESSION = _createrepo_c.AUTO_DETECT_COMPRESSION UNKNOWN_COMPRESSION = _createrepo_c.UNKNOWN_COMPRESSION diff --git a/src/python/createrepo_cmodule.c b/src/python/createrepo_cmodule.c index a41fae7..8b05779 100644 --- a/src/python/createrepo_cmodule.c +++ b/src/python/createrepo_cmodule.c @@ -144,6 +144,7 @@ init_createrepo_c(void) PyModule_AddIntConstant(m, "VERSION_PATCH", CR_VERSION_PATCH); /* Checksum types */ + PyModule_AddIntConstant(m, "CHECKSUM_UNKNOWN", CR_CHECKSUM_UNKNOWN); PyModule_AddIntConstant(m, "MD5", CR_CHECKSUM_MD5); PyModule_AddIntConstant(m, "SHA", CR_CHECKSUM_SHA); PyModule_AddIntConstant(m, "SHA1", CR_CHECKSUM_SHA1); diff --git a/tests/python/tests/test_checksum.py b/tests/python/tests/test_checksum.py index f1fc669..10292f0 100644 --- a/tests/python/tests/test_checksum.py +++ b/tests/python/tests/test_checksum.py @@ -33,3 +33,5 @@ class TestCaseChecksum(unittest.TestCase): self.assertEqual(cr.checksum_type("sha384"), cr.SHA384) self.assertEqual(cr.checksum_type("sha512"), cr.SHA512) + self.assertEqual(cr.checksum_type("foobar"), cr.UNKNOWN_CHECKSUM) + -- 2.7.4