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