repo2docker/tests/julia/require-1-requirements-file/verify

35 wiersze
974 B
Julia
Executable File

#!/usr/bin/env julia
using PyCall
using PyPlot
if ! (VERSION >= v"1" && VERSION < v"2")
println("Julia version was: ", VERSION)
println("Julia version expected to be 1.x when pinned to 1 in a REQUIRE file")
exit(1)
end
# Make sure we are re-using the same conda python
if ! startswith(PyCall.libpython, ENV["NB_PYTHON_PREFIX"] * "/lib")
println("Not re-using conda python! Using " * PyCall.libpython * " instead")
exit(1)
end
# We check that PyPlot is installed inside ${JULIA_DEPOT_PATH}
if ! isdir(ENV["JULIA_DEPOT_PATH"] * "/packages/PyPlot")
println("PyPlot not installed under JULIA_DEPOT_PATH")
exit(1)
end
# FIXME: Julia code that worked before v1, but now fails with:
#
# ERROR: LoadError: UndefVarError: linspace not defined
#
# x = linspace(0,2*pi,1000); y = sin(3*x + 4*cos(2*x))
# plot(x, y, color="red", linewidth=2.0, linestyle="--")
# savefig("graph.png")
# if isfile("graph.png")
# exit(0)
# else
# exit(1)
# end