diff --git a/pyopencl/_mymako.py b/pyopencl/_mymako.py new file mode 100644 index 0000000000000000000000000000000000000000..a4e4b46505c013d7d28058afeace5834e56f53d5 --- /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 9348253d7fefe1b657bf69c8ef9872ce075c555d..85528b1903f02e1f085d3e0e23d2d63c73fb5608 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