From 9ddcd19beb20f1136fb209c3e698041a56b33d9e Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Sun, 20 Mar 2011 04:09:12 -0400
Subject: [PATCH] Add pyopencl._mymako.

---
 pyopencl/_mymako.py   | 14 ++++++++++++++
 pyopencl/reduction.py | 15 +--------------
 2 files changed, 15 insertions(+), 14 deletions(-)
 create mode 100644 pyopencl/_mymako.py

diff --git a/pyopencl/_mymako.py b/pyopencl/_mymako.py
new file mode 100644
index 00000000..a4e4b465
--- /dev/null
+++ b/pyopencl/_mymako.py
@@ -0,0 +1,14 @@
+try:
+    import mako.template
+except ImportError:
+    raise ImportError(
+            "Some of PyOpenCL's facilities require the Mako templating engine.\n"
+            "You or a piece of software you have used has tried to call such a\n"
+            "part of PyOpenCL, but there was a problem importing Mako.\n\n"
+            "You may install mako now by typing one of:\n"
+            "- easy_install Mako\n"
+            "- pip install Mako\n"
+            "- aptitude install python-mako\n"
+            "\nor whatever else is appropriate for your system.")
+
+from mako import *
diff --git a/pyopencl/reduction.py b/pyopencl/reduction.py
index 9348253d..85528b19 100644
--- a/pyopencl/reduction.py
+++ b/pyopencl/reduction.py
@@ -39,20 +39,7 @@ from pyopencl.tools import (
         dtype_to_ctype)
 from pytools import memoize_method
 import numpy as np
-
-try:
-    import mako
-except ImportError:
-    raise ImportError(
-            "PyOpenCL's reduction facility requires the Mako templating engine.\n"
-            "You or a piece of software you have used has tried to call PyOpenCL's\n"
-            "reduction code, but there was a problem importing Mako.\n\n"
-            "You may install mako now by typing one of:\n"
-            "- easy_install Mako\n"
-            "- pip install Mako\n"
-            "- aptitude install python-mako\n"
-            "\nor whatever else is appropriate for your system.")
-
+import pyopencl._mymako as mako
 
 
 
-- 
GitLab