From 7839ae5a4a618c0eacd2e95c7d4392f6542b3ffd Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Mon, 21 Feb 2011 14:42:56 -0500
Subject: [PATCH] Add warning code for importing for source directory.

---
 pyopencl/__init__.py | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/pyopencl/__init__.py b/pyopencl/__init__.py
index ca91c73f..29c511ab 100644
--- a/pyopencl/__init__.py
+++ b/pyopencl/__init__.py
@@ -1,6 +1,18 @@
 from pyopencl.version import VERSION, VERSION_STATUS, VERSION_TEXT
 
-import pyopencl._cl as _cl
+try:
+    import pyopencl._cl as _cl
+except ImportError:
+    import os
+    from os.path import dirname, join, realpath
+    if realpath(join(os.getcwd(), "pyopencl")) == realpath(dirname(__file__)):
+        from warnings import warn
+        warn ("It looks like you are importing PyOpenCL from the "
+                "its source directory. This likely won't work.")
+    raise
+
+
+
 from pyopencl._cl import *
 import inspect as _inspect
 
-- 
GitLab