Author: Alexander Schremmer <alex AT alexanderweb DOT de>
Branch: 
Changeset: r309:4f9c89d1a521
Date: 2015-02-22 17:12 +0100
http://bitbucket.org/pypy/benchmarks/changeset/4f9c89d1a521/

Log:    (focs, xoraxax) Make import logic more robust, also add readthedocs
        package dir to python path for settings package.

diff --git a/multithread/wsgi/readthedocs.py b/multithread/wsgi/read_the_docs.py
rename from multithread/wsgi/readthedocs.py
rename to multithread/wsgi/read_the_docs.py
--- a/multithread/wsgi/readthedocs.py
+++ b/multithread/wsgi/read_the_docs.py
@@ -1,10 +1,16 @@
+import os
+import sys
+
+import readthedocs
+from readthedocs import wsgi
 
 
 REQUEST_LIST = [
         '/',
         ]
 
+
 def make_app():
-    from readthedocs import wsgi
+    sys.path.append(os.path.dirname(readthedocs.__file__))
 
     return wsgi.application
diff --git a/multithread/wsgi/webapp.py b/multithread/wsgi/webapp.py
--- a/multithread/wsgi/webapp.py
+++ b/multithread/wsgi/webapp.py
@@ -1,4 +1,4 @@
-
+import os
 import sys
 import threading
 
@@ -14,7 +14,9 @@
 def init(benchmark, request_count=100, *args):
     settings["request_count"] = request_count
 
-    bm_module = __import__(benchmark)
+    bm_module = type(sys)("bm_module")
+    file_name = os.path.join(os.path.dirname(__file__), benchmark + ".py")
+    execfile(file_name, bm_module.__dict__)
 
     if not hasattr(bm_module, 'REQUEST_LIST'):
         print 'request list not defined'
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to