summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Bartosh <eduard.bartosh@intel.com>2013-08-10 21:55:03 +0300
committerEduard Bartosh <eduard.bartosh@intel.com>2013-08-12 23:55:43 -0700
commit23e81434023fd632dcd5d5f15d2c8f40da531b6f (patch)
treecb952eeb51e49a7143ba2b6f0e67817cdf939a2f
parent6283be55aa6f5e0a0203a923bec2b802bf1ee73a (diff)
downloadrepa-23e81434023fd632dcd5d5f15d2c8f40da531b6f.tar.gz
repa-23e81434023fd632dcd5d5f15d2c8f40da531b6f.tar.bz2
repa-23e81434023fd632dcd5d5f15d2c8f40da531b6f.zip
Added namespace package example
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>
-rw-r--r--examples/namespace/repa/__init__.py13
-rw-r--r--examples/namespace/repa/module.py14
-rw-r--r--examples/namespace/setup.py22
3 files changed, 49 insertions, 0 deletions
diff --git a/examples/namespace/repa/__init__.py b/examples/namespace/repa/__init__.py
new file mode 100644
index 0000000..49df581
--- /dev/null
+++ b/examples/namespace/repa/__init__.py
@@ -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
index 0000000..dc1ea96
--- /dev/null
+++ b/examples/namespace/repa/module.py
@@ -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
index 0000000..da90d4f
--- /dev/null
+++ b/examples/namespace/setup.py
@@ -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']
+)