Added namespace package example
authorEd Bartosh <eduard.bartosh@intel.com>
Sat, 10 Aug 2013 18:55:03 +0000 (21:55 +0300)
committerEduard Bartosh <eduard.bartosh@intel.com>
Tue, 13 Aug 2013 06:55:43 +0000 (23:55 -0700)
Example shows how to implement namespace repa package. Namespace
packages are used to distribute extra functionality separately from
repa, but within repa namespace. External modules implemented this way
can be imported this way 'from repa import module'.

Change-Id: I79da170c4ba2562c7a022428c556ba06f2519e49
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
Reviewed-on: https://otctools.jf.intel.com/review/5837
Tested-by: OTC Tools Tester <ed.bartosh@linux.intel.com>
examples/namespace/repa/__init__.py [new file with mode: 0644]
examples/namespace/repa/module.py [new file with mode: 0644]
examples/namespace/setup.py [new file with mode: 0644]

diff --git a/examples/namespace/repa/__init__.py b/examples/namespace/repa/__init__.py
new file mode 100644 (file)
index 0000000..49df581
--- /dev/null
@@ -0,0 +1,13 @@
+"""
+REPA: Release Engineering Process Assistant.
+
+Copyright (C) Intel Corporation 2013
+Licence: GPL version 2
+Author: Ed Bartosh <eduard.bartosh@intel.com>
+
+Init.
+Namespace declaration.
+"""
+
+import pkg_resources
+pkg_resources.declare_namespace(__name__)
diff --git a/examples/namespace/repa/module.py b/examples/namespace/repa/module.py
new file mode 100644 (file)
index 0000000..dc1ea96
--- /dev/null
@@ -0,0 +1,14 @@
+#!/usr/bin/env python
+
+"""
+REPA: Release Engineering Process Assistant.
+
+Copyright (C) Intel Corporation 2013
+Licence: GPL version 2
+Author: Ed Bartosh <eduard.bartosh@intel.com>
+
+Test namespace package.
+After installation it can be imported this way:
+from repa import module
+"""
+
diff --git a/examples/namespace/setup.py b/examples/namespace/setup.py
new file mode 100644 (file)
index 0000000..da90d4f
--- /dev/null
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+
+"""
+REPA: Release Engineering Process Assistant.
+Example repa namespace package
+
+Copyright (C) Intel Corporation 2013
+Licence: GPL version 2
+Author: Ed Bartosh <eduard.bartosh@intel.com>
+
+Setup module
+"""
+
+from setuptools import setup
+
+setup(name = "repa_namespace_package",
+      version = '0.0.1',
+      author = 'Ed Bartosh',
+      author_email = 'eduard.bartosh@intel.com',
+      packages = ['repa'],
+      namespace_packages = ['repa']
+)