From 0e3c96408a462b64bddbe34e456656b8f2e4d058 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iusty@k1024.org>
Date: Fri, 27 Jun 2008 09:00:08 +0200
Subject: [PATCH] Export features as a module attributes

Currently it's hard to check from python if the current build of the
library has support for X or Y (e.g. acl from mode, etc.). So we export
this as module-level constants and this will allow users to check:
  if posix1e.HAS_ACL_FROM_MODE:
    acl = posix1e.ACL(mode=0644)
---
 acl.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/acl.c b/acl.c
index a477b73..cc48052 100644
--- a/acl.c
+++ b/acl.c
@@ -1491,4 +1491,17 @@ void initposix1e(void) {
     PyModule_AddIntConstant(m, "ACL_ENTRY_ERROR", ACL_ENTRY_ERROR);
 #endif
 
+    /* Document extended functionality via easy-to-use constants */
+#ifdef HAVE_LEVEL2
+    PyModule_AddIntConstant(m, "HAS_ACL_MANIPULATION", 1);
+#else
+    PyModule_AddIntConstant(m, "HAS_ACL_MANIPULATION", 0);
+#endif
+
+#ifdef HAVE_LINUX
+    PyModule_AddIntConstant(m, "HAS_ACL_FROM_MODE", 1);
+#else
+    PyModule_AddIntConstant(m, "HAS_ACL_FROM_MODE", 0);
+#endif
+
 }
-- 
2.39.5