From 23e81434023fd632dcd5d5f15d2c8f40da531b6f Mon Sep 17 00:00:00 2001 From: Ed Bartosh Date: Sat, 10 Aug 2013 21:55:03 +0300 Subject: [PATCH] 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 Reviewed-on: https://otctools.jf.intel.com/review/5837 Tested-by: OTC Tools Tester --- examples/namespace/repa/__init__.py | 13 +++++++++++++ examples/namespace/repa/module.py | 14 ++++++++++++++ examples/namespace/setup.py | 22 ++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 examples/namespace/repa/__init__.py create mode 100644 examples/namespace/repa/module.py create mode 100644 examples/namespace/setup.py 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 + +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 + +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 + +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'] +) -- 2.7.4