summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIsaku Yamahata <yamahata@valinux.co.jp>2012-10-12 11:16:19 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2012-11-03 15:02:57 +0900
commit0ae9c296877d2f5e6284adde86cfcbe40d04ac36 (patch)
tree97c6510c793774d6296ecf386da0bf591fff6974
parent6eeddaa2a43c86f9c431330125be001ff062698a (diff)
prepare contrib directory which holds third party library
- create ryu/contrib directory - adjust module load path for third party library and prioritize our own copy than system's - teach ryu-manager ryu/contrib - run_tests.sh: exclude contrib dir for pep8 third party files will be included under ryu/contrib. Third party files aren't suitable to our pep8 check because they aren't under our control. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
-rwxr-xr-xbin/ryu-manager6
-rwxr-xr-xrun_tests.sh2
-rw-r--r--ryu/contrib/__init__.py11
3 files changed, 18 insertions, 1 deletions
diff --git a/bin/ryu-manager b/bin/ryu-manager
index 4d6c4908..002cc590 100755
--- a/bin/ryu-manager
+++ b/bin/ryu-manager
@@ -33,6 +33,12 @@ from ryu.app import wsgi
from ryu.base.app_manager import AppManager
from ryu.controller import controller
+# TODO:
+# Right now, we have our own patched copy of ovs python bindings
+# Once our modification is upstreamed and widely deployed,
+# use it
+import ryu.contrib
+
FLAGS = gflags.FLAGS
gflags.DEFINE_bool('version', False, 'output version information and exit')
diff --git a/run_tests.sh b/run_tests.sh
index 2ca8e45a..a00d2a88 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -99,7 +99,7 @@ function run_pylint {
function run_pep8 {
echo "Running pep8 ..."
- PEP8_EXCLUDE="vcsversion.py,*.pyc"
+ PEP8_EXCLUDE="vcsversion.py,*.pyc,contrib"
PEP8_OPTIONS="--exclude=$PEP8_EXCLUDE --repeat --show-source"
PEP8_INCLUDE="bin/* ryu setup*.py"
PEP8_LOG=pep8.log
diff --git a/ryu/contrib/__init__.py b/ryu/contrib/__init__.py
new file mode 100644
index 00000000..dbceb1f9
--- /dev/null
+++ b/ryu/contrib/__init__.py
@@ -0,0 +1,11 @@
+# Ajust module loading path for third party library
+import os
+import sys
+
+for path in __path__:
+ if path in sys.path:
+ sys.path.remove(path)
+ path = os.path.abspath(path)
+ if path in sys.path:
+ sys.path.remove(path)
+ sys.path.insert(0, path) # prioritize our own copy than system's