mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-12-09 13:16:08 +08:00
Require OTP 25 (#2333)
This commit is contained in:
parent
df80d44e84
commit
2ed8021dbd
4 changed files with 15 additions and 45 deletions
|
|
@ -965,38 +965,15 @@ defmodule Livebook.Runtime.Evaluator do
|
|||
defp prune_stacktrace(_module, [{Livebook.Runtime.Evaluator.Tracer, _fun, _arity, _meta} | _]),
|
||||
do: []
|
||||
|
||||
# Adapted from https://github.com/elixir-lang/elixir/blob/1c1654c88adfdbef38ff07fc30f6fbd34a542c07/lib/iex/lib/iex/evaluator.ex#L355-L372
|
||||
# TODO: Remove else branch once we depend on the versions below
|
||||
if System.otp_release() >= "25" do
|
||||
defp prune_stacktrace(module, stack) do
|
||||
stack
|
||||
|> Enum.reverse()
|
||||
|> Enum.drop_while(&(elem(&1, 0) != module))
|
||||
|> Enum.reverse()
|
||||
|> case do
|
||||
[] -> stack
|
||||
stack -> stack
|
||||
end
|
||||
end
|
||||
else
|
||||
@elixir_internals [:elixir, :elixir_expand, :elixir_compiler, :elixir_module] ++
|
||||
[:elixir_clauses, :elixir_lexical, :elixir_def, :elixir_map] ++
|
||||
[:elixir_erl, :elixir_erl_clauses, :elixir_erl_pass]
|
||||
|
||||
defp prune_stacktrace(_, stacktrace) do
|
||||
# The order in which each drop_while is listed is important.
|
||||
# For example, the user may call Code.eval_string/2 in their
|
||||
# code and if there is an error we should not remove erl_eval
|
||||
# and eval_bits information from the user stacktrace.
|
||||
stacktrace
|
||||
|> Enum.reverse()
|
||||
|> Enum.drop_while(&(elem(&1, 0) == :proc_lib))
|
||||
|> Enum.drop_while(&(elem(&1, 0) == :gen_server))
|
||||
|> Enum.drop_while(&(elem(&1, 0) == __MODULE__))
|
||||
|> Enum.drop_while(&(elem(&1, 0) == :elixir))
|
||||
|> Enum.drop_while(&(elem(&1, 0) in [:erl_eval, :eval_bits]))
|
||||
|> Enum.reverse()
|
||||
|> Enum.reject(&(elem(&1, 0) in @elixir_internals))
|
||||
# See https://github.com/elixir-lang/elixir/blob/792d4cc6310c56eb9772056a6b5fb3339ce17b0f/lib/iex/lib/iex/evaluator.ex#L436-L445
|
||||
defp prune_stacktrace(module, stack) do
|
||||
stack
|
||||
|> Enum.reverse()
|
||||
|> Enum.drop_while(&(elem(&1, 0) != module))
|
||||
|> Enum.reverse()
|
||||
|> case do
|
||||
[] -> stack
|
||||
stack -> stack
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -200,17 +200,6 @@ defmodule Livebook.Utils.HTTP do
|
|||
end
|
||||
end
|
||||
|
||||
# Load SSL certificates
|
||||
|
||||
crt_file = CAStore.file_path()
|
||||
crt = File.read!(crt_file)
|
||||
pems = :public_key.pem_decode(crt)
|
||||
ders = Enum.map(pems, fn {:Certificate, der, _} -> der end)
|
||||
|
||||
# Note: we need to load the certificates at compilation time, as we
|
||||
# don't have access to package files in Escript.
|
||||
@cacerts ders
|
||||
|
||||
defp http_ssl_opts() do
|
||||
# Use secure options, see https://gist.github.com/jonatanklosko/5e20ca84127f6b31bbe3906498e1a1d7
|
||||
|
||||
|
|
@ -218,7 +207,7 @@ defmodule Livebook.Utils.HTTP do
|
|||
if cacertfile = Livebook.Config.cacertfile() do
|
||||
{:cacertfile, to_charlist(cacertfile)}
|
||||
else
|
||||
{:cacerts, @cacerts}
|
||||
{:cacerts, :public_key.cacerts_get()}
|
||||
end
|
||||
|
||||
[
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ defmodule LivebookWeb.Helpers.Codec do
|
|||
|
||||
file_offset = max(offset - @wav_header_size, 0)
|
||||
|
||||
# TODO: use File.stream!(path, [{:read_offset, file_offset}]) once we require Elixir v1.16+
|
||||
file_stream = raw_file_range_stream!(path, file_offset, file_length)
|
||||
|
||||
file_stream =
|
||||
|
|
|
|||
5
mix.exs
5
mix.exs
|
|
@ -1,3 +1,7 @@
|
|||
if System.otp_release() < "25" do
|
||||
Mix.raise("Livebook requires Erlang/OTP 25+")
|
||||
end
|
||||
|
||||
defmodule Livebook.MixProject do
|
||||
use Mix.Project
|
||||
|
||||
|
|
@ -105,7 +109,6 @@ defmodule Livebook.MixProject do
|
|||
{:bandit, "~> 1.0"},
|
||||
{:plug_crypto, "~> 2.0"},
|
||||
{:earmark_parser, "~> 1.4"},
|
||||
{:castore, "~> 1.0"},
|
||||
{:ecto, "~> 3.10"},
|
||||
{:phoenix_ecto, "~> 4.4"},
|
||||
{:aws_signature, "~> 0.3.0"},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue