Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch to specifying the relative location of the sysimg directly #16

Merged
merged 1 commit into from
Sep 1, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions julia/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,18 +224,22 @@ def __init__(self, init_julia=True, jl_init_path=None):
println(JULIA_HOME)
println(Sys.dlpath(dlopen(\"libjulia\")))
"""])
JULIA_HOME, jpath = juliainfo.decode("utf-8").rstrip().split("\n")
JULIA_HOME, libjulia_path = juliainfo.decode("utf-8").rstrip().split("\n")
libjulia_dir = os.path.dirname(libjulia_path)
sysimg_relpath = os.path.join(os.path.relpath(libjulia_dir, JULIA_HOME), "sys.ji")
except:
raise JuliaError('error starting up the Julia process')

if not os.path.exists(jpath):
raise JuliaError("Julia library not found! {}".format(jpath))

self.api = ctypes.PyDLL(jpath, ctypes.RTLD_GLOBAL)

if not os.path.exists(libjulia_path):
raise JuliaError("Julia library (\"libjulia\") not found! {}".format(libjulia_path))

if not os.path.exists(os.path.join(JULIA_HOME, sysimg_relpath)):
raise JuliaError("Julia sysimage (\"sys.ji\") not found! {}".format(sysimg_relpath))

self.api = ctypes.PyDLL(libjulia_path, ctypes.RTLD_GLOBAL)
self.api.jl_init_with_image.arg_types = [char_p, char_p]
self.api.jl_init.arg_types = [char_p]

self.api.jl_init(JULIA_HOME.encode("utf-8"))
self.api.jl_init_with_image(JULIA_HOME.encode("utf-8"),
sysimg_relpath.encode("utf-8"))
else:
# we're assuming here we're fully inside a running Julia process,
# so we're fishing for symbols in our own process table
Expand Down