Skip to content

Commit

Permalink
Merged in fix-generator (pull request #174)
Browse files Browse the repository at this point in the history
Fix bugs with the generator.
  • Loading branch information
prabhuramachandran committed May 22, 2015
2 parents d851707 + 5f3dea6 commit 8190a9e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 2 additions & 3 deletions pysph/base/c_kernels.pyx.mako
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ from libc.math cimport *
import numpy as np

<%
from pysph.base.cython_generator import CythonGenerator
from pysph.base.kernels import (CubicSpline, WendlandQuintic, Gaussian,
QuinticSpline)
from cython_generator import CythonGenerator
from kernels import CubicSpline, WendlandQuintic, Gaussian, QuinticSpline
generator = CythonGenerator(python_methods=True)
%>

Expand Down
10 changes: 7 additions & 3 deletions pyzoltan/core/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,18 @@ def generate_files(dirname, if_modified=True):
message = 'generating file {outfile} from {filename}'.format(
outfile=outfile, filename=filename
)
if if_modified and not is_modified_later(filename, outfile):
print('not ' + message)
else:
if not os.path.exists(outfile) or \
not if_modified and is_modified_later(filename, outfile):
# Inject the directory of the output file into the path,
# so that local imports will work.
sys.path.insert(0, os.path.dirname(outfile))
from mako.template import Template
print(message)
template = Template(filename=filename)
with open(outfile, 'w') as fp:
fp.write(template.render())
else:
print('Not ' + message)

def main(paths=None):
'''Generates source files using mako template files.
Expand Down

0 comments on commit 8190a9e

Please sign in to comment.