590d18
From 9e5c97ffdc7a42f6f76affbc9a791496ba245557 Mon Sep 17 00:00:00 2001
590d18
From: Tomas Babej <tbabej@redhat.com>
590d18
Date: Thu, 2 Jul 2015 12:38:43 +0200
590d18
Subject: [PATCH] ipaplatform: Add constants submodule
590d18
590d18
Introduce a ipaplatform/constants.py file to store platform related
590d18
constants, which are not paths.
590d18
590d18
Reviewed-By: Martin Basti <mbasti@redhat.com>
590d18
Reviewed-By: Petr Spacek <pspacek@redhat.com>
590d18
---
590d18
 Makefile                        |  3 ++-
590d18
 freeipa.spec.in                 |  2 ++
590d18
 ipaplatform/base/constants.py   | 11 +++++++++++
590d18
 ipaplatform/fedora/constants.py | 16 ++++++++++++++++
590d18
 ipaplatform/redhat/constants.py | 17 +++++++++++++++++
590d18
 ipaplatform/rhel/constants.py   | 16 ++++++++++++++++
590d18
 6 files changed, 64 insertions(+), 1 deletion(-)
590d18
 create mode 100644 ipaplatform/base/constants.py
590d18
 create mode 100644 ipaplatform/fedora/constants.py
590d18
 create mode 100644 ipaplatform/redhat/constants.py
590d18
 create mode 100644 ipaplatform/rhel/constants.py
590d18
590d18
diff --git a/Makefile b/Makefile
590d18
index abf58382960099a54b8920dd0e741b9fda17682f..3c81466d3728022c1d9cf5bb216990f14a59b7e5 100644
590d18
--- a/Makefile
590d18
+++ b/Makefile
590d18
@@ -159,10 +159,11 @@ version-update: release-update
590d18
 	if [ "$(SUPPORTED_PLATFORM)" != "" ]; then \
590d18
 		sed -e s/__PLATFORM__/$(SUPPORTED_PLATFORM)/ \
590d18
 			ipaplatform/__init__.py.in > ipaplatform/__init__.py; \
590d18
-		rm -f ipaplatform/paths.py ipaplatform/services.py ipaplatform/tasks.py; \
590d18
+		rm -f ipaplatform/paths.py ipaplatform/services.py ipaplatform/tasks.py ipaplatform/constants.py; \
590d18
 		ln -s $(SUPPORTED_PLATFORM)/paths.py ipaplatform/paths.py; \
590d18
 		ln -s $(SUPPORTED_PLATFORM)/services.py ipaplatform/services.py; \
590d18
 		ln -s $(SUPPORTED_PLATFORM)/tasks.py ipaplatform/tasks.py; \
590d18
+		ln -s $(SUPPORTED_PLATFORM)/constants.py ipaplatform/constants.py; \
590d18
 	fi
590d18
 
590d18
 	if [ "$(SKIP_API_VERSION_CHECK)" != "yes" ]; then \
590d18
diff --git a/freeipa.spec.in b/freeipa.spec.in
590d18
index 5790f7941d2117ed95d3c99556f1579c27917270..e9ba596fec1f8d179d4f834485e35a4814db898d 100644
590d18
--- a/freeipa.spec.in
590d18
+++ b/freeipa.spec.in
590d18
@@ -363,6 +363,7 @@ rm -f ipapython/version.py
590d18
 rm -f ipaplatform/services.py
590d18
 rm -f ipaplatform/tasks.py
590d18
 rm -f ipaplatform/paths.py
590d18
+rm -f ipaplatform/constants.py
590d18
 make version-update
590d18
 cd ipa-client; ../autogen.sh --prefix=%{_usr} --sysconfdir=%{_sysconfdir} --localstatedir=%{_localstatedir} --libdir=%{_libdir} --mandir=%{_mandir}; cd ..
590d18
 %if ! %{ONLY_CLIENT}
590d18
@@ -385,6 +386,7 @@ rm -f ipapython/version.py
590d18
 rm -f ipaplatform/services.py
590d18
 rm -f ipaplatform/tasks.py
590d18
 rm -f ipaplatform/paths.py
590d18
+rm -f ipaplatform/constants.py
590d18
 make version-update
590d18
 %if ! %{ONLY_CLIENT}
590d18
 make install DESTDIR=%{buildroot}
590d18
diff --git a/ipaplatform/base/constants.py b/ipaplatform/base/constants.py
590d18
new file mode 100644
590d18
index 0000000000000000000000000000000000000000..70485055fa5a12fac878ace3dea11ea442ebe6be
590d18
--- /dev/null
590d18
+++ b/ipaplatform/base/constants.py
590d18
@@ -0,0 +1,11 @@
590d18
+#
590d18
+# Copyright (C) 2015  FreeIPA Contributors see COPYING for license
590d18
+#
590d18
+
590d18
+'''
590d18
+This base platform module exports platform dependant constants.
590d18
+'''
590d18
+
590d18
+
590d18
+class BaseConstantsNamespace(object):
590d18
+    pass
590d18
diff --git a/ipaplatform/fedora/constants.py b/ipaplatform/fedora/constants.py
590d18
new file mode 100644
590d18
index 0000000000000000000000000000000000000000..ce03f58cf95be1a72a9ce3da65e6d21ef193cefe
590d18
--- /dev/null
590d18
+++ b/ipaplatform/fedora/constants.py
590d18
@@ -0,0 +1,16 @@
590d18
+#
590d18
+# Copyright (C) 2015  FreeIPA Contributors see COPYING for license
590d18
+#
590d18
+
590d18
+'''
590d18
+This Fedora base platform module exports platform related constants.
590d18
+'''
590d18
+
590d18
+# Fallback to default constant definitions
590d18
+from ipaplatform.redhat.constants import RedHatConstantsNamespace
590d18
+
590d18
+
590d18
+class FedoraConstantsNamespace(RedHatConstantsNamespace):
590d18
+    pass
590d18
+
590d18
+constants = FedoraConstantsNamespace()
590d18
diff --git a/ipaplatform/redhat/constants.py b/ipaplatform/redhat/constants.py
590d18
new file mode 100644
590d18
index 0000000000000000000000000000000000000000..7209947f8afbd688b02c8b134d33185e497befe0
590d18
--- /dev/null
590d18
+++ b/ipaplatform/redhat/constants.py
590d18
@@ -0,0 +1,17 @@
590d18
+#
590d18
+# Copyright (C) 2015  FreeIPA Contributors see COPYING for license
590d18
+#
590d18
+
590d18
+'''
590d18
+This Red Hat OS family base platform module exports default platform
590d18
+related constants for the Red Hat OS family-based systems.
590d18
+'''
590d18
+
590d18
+# Fallback to default path definitions
590d18
+from ipaplatform.base.constants import BaseConstantsNamespace
590d18
+
590d18
+
590d18
+class RedHatConstantsNamespace(BaseConstantsNamespace):
590d18
+    pass
590d18
+
590d18
+constants = RedHatConstantsNamespace()
590d18
diff --git a/ipaplatform/rhel/constants.py b/ipaplatform/rhel/constants.py
590d18
new file mode 100644
590d18
index 0000000000000000000000000000000000000000..eaca48030fa28804c70c161b07228646a95fc1a3
590d18
--- /dev/null
590d18
+++ b/ipaplatform/rhel/constants.py
590d18
@@ -0,0 +1,16 @@
590d18
+#
590d18
+# Copyright (C) 2015  FreeIPA Contributors see COPYING for license
590d18
+#
590d18
+
590d18
+'''
590d18
+This RHEL base platform module exports platform related constants.
590d18
+'''
590d18
+
590d18
+# Fallback to default constant definitions
590d18
+from ipaplatform.redhat.constants import RedHatConstantsNamespace
590d18
+
590d18
+
590d18
+class RHELConstantsNamespace(RedHatConstantsNamespace):
590d18
+    pass
590d18
+
590d18
+constants = RHELConstantsNamespace()
590d18
-- 
590d18
2.4.3
590d18