Skip to content

Commit

Permalink
jupyter-r: update test
Browse files Browse the repository at this point in the history
  • Loading branch information
cho-m committed Dec 28, 2024
1 parent ee613c4 commit 8958387
Showing 1 changed file with 29 additions and 61 deletions.
90 changes: 29 additions & 61 deletions Formula/j/jupyter-r.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ class JupyterR < Formula
depends_on "r"
depends_on "zeromq"

uses_from_macos "expect" => :test

on_macos do
depends_on "gettext"
end
Expand Down Expand Up @@ -136,7 +134,11 @@ class JupyterR < Formula
sha256 "da7e204d857370201f75a05fbd808a2f409d440cc96855bb8f48f4a5dd75405b"

# Remove use of -flat_namespace.
patch :DATA
patch do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/03cf8088210822aa2c1ab544ed58ea04c897d9c4/libtool/configure-pre-0.4.2.418-big_sur.diff"
sha256 "83af02f2aa2b746bb7225872cab29a253264be49db0ecebb12f841562d9a2923"
directory "src/zmqsrc"
end
end

resource "crayon" do
Expand Down Expand Up @@ -191,63 +193,29 @@ def install
ENV["R_LIBS_SITE"] = lib/"R/site-library"
assert_match " ir ", shell_output("#{jupyter} kernelspec list")

(testpath/"console.exp").write <<~EOS
spawn #{jupyter} console --kernel=ir
expect -timeout 60 "In "
send "print('Hello Homebrew')\r"
expect -timeout 60 "In "
send "exit\r"
EOS
output = shell_output("expect -f console.exp")
assert_match "R version #{r_version}", output
assert_match "Hello Homebrew", output
require "expect"
require "pty"
PTY.spawn(jupyter, "console", "--kernel=ir") do |r, w, pid|
timeout = 30
r.expect("In [1]:", timeout) do |result|
refute_nil result, "Expected In [1] prompt"
assert_match "R version #{r_version}", result.first
end
w.write "print('Hello Homebrew')\r"
r.expect("In [2]:", timeout) do |result|
refute_nil result, "Expected In [2] prompt"
assert_match '[1] "Hello Homebrew"', result.first
end
w.write "mean(c(1, 2, 3, 4))\r"
r.expect("In [3]:", timeout) do |result|
refute_nil result, "Expected In [3] prompt"
assert_match "[1] 2.5", result.first
end
w.write "quit()\r"
ensure
r.close
w.close
Process.wait(pid)
end
end
end

__END__
--- a/src/zmqsrc/config/libtool.m4
+++ b/src/zmqsrc/config/libtool.m4
@@ -1045,16 +1045,11 @@ _LT_EOF
_lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
darwin1.*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
- darwin*) # darwin 5.x on
- # if running on 10.5 or later, the deployment target defaults
- # to the OS version, if on x86, and 10.4, the deployment
- # target defaults to 10.4. Don't you love it?
- case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
- 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
- _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
- 10.[[012]]*)
+ darwin*)
+ case ${MACOSX_DEPLOYMENT_TARGET},$host in
+ 10.[[012]],*|,*powerpc*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
- 10.*)
+ *)
_lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
esac
;;
--- a/src/zmqsrc/configure
+++ b/src/zmqsrc/configure
@@ -10686,16 +10686,11 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
_lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
darwin1.*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
- darwin*) # darwin 5.x on
- # if running on 10.5 or later, the deployment target defaults
- # to the OS version, if on x86, and 10.4, the deployment
- # target defaults to 10.4. Don't you love it?
- case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
- 10.0,*86*-darwin8*|10.0,*-darwin[91]*)
- _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
- 10.[012]*)
+ darwin*)
+ case ${MACOSX_DEPLOYMENT_TARGET},$host in
+ 10.[012],*|,*powerpc*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
- 10.*)
+ *)
_lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
esac
;;

0 comments on commit 8958387

Please sign in to comment.