Skip to content

Commit

Permalink
Change the pyke import order, to deal with the CWD bug identified in #…
Browse files Browse the repository at this point in the history
  • Loading branch information
pelson committed Nov 2, 2017
1 parent 5f93806 commit d46250e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ def compile_pyke_rules(cmd, directory):
shelled_code = textwrap.dedent("""\
import os
from pyke import knowledge_engine
# Monkey patch the load method to avoid "ModuleNotFoundError: No module
# named 'iris.fileformats._pyke_rules.compiled_krb'". In this instance
Expand All @@ -125,7 +124,11 @@ def compile_pyke_rules(cmd, directory):
# Compile the rules by hand, without importing iris. That way we can
# avoid the need for all of iris' dependencies being installed.
os.chdir(os.path.join('{bld_dir}', 'iris', 'fileformats', '_pyke_rules'))
# Import pyke *after* changing directory. Without this we get the compiled
# rules in the wrong place. Identified in
# https://github.com/SciTools/iris/pull/2891#issuecomment-341404187
from pyke import knowledge_engine
knowledge_engine.engine('')
""".format(bld_dir=directory)).split('\n')
Expand Down

0 comments on commit d46250e

Please sign in to comment.