Skip to content

Commit

Permalink
fix(basedpyright): use python installation
Browse files Browse the repository at this point in the history
  • Loading branch information
nikaro committed Aug 4, 2024
1 parent 611ce03 commit 0f4e872
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions Formula/basedpyright.rb
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
require "language/node"

class Basedpyright < Formula
include Language::Python::Virtualenv

desc "Pyright fork with various improvements and built-in pylance features"
homepage "https://github.com/DetachHead/basedpyright"
url "https://github.com/DetachHead/basedpyright/archive/refs/tags/v1.15.1.tar.gz"
sha256 "51fb7cfc0ad1eae6073c4b6360466f7f696b8b25b5779aee20589a4e01d3dd22"
url "https://files.pythonhosted.org/packages/10/56/0b764d7a0495a727057657d9541833be13467a0c36b8970cbe4ed8b9891a/basedpyright-1.15.1.tar.gz"
sha256 "76e67453a3c3839506952de9f620d55aa1e3fcf2dbb276405df878bc83a185ee"
license "MIT"
revision 1

bottle do
root_url "https://github.com/nikaro/homebrew-tap/releases/download/basedpyright-1.15.1"
sha256 cellar: :any_skip_relocation, arm64_sonoma: "4c89a246d46f47cbda0ead165c15ab074c729d997d34885476f2132fc7316878"
sha256 cellar: :any_skip_relocation, x86_64_linux: "161b32f442fb5c50e63b39f8753fb4e1c76258f96dfe25e178f8cdbf2bb34f93"
end
depends_on "cmake" => :build
depends_on "rust" => :build
depends_on "[email protected]"

depends_on "node"
resource "nodejs-wheel-binaries" do
url "https://files.pythonhosted.org/packages/36/7a/9c3e424382eda040b01f344b7a64b11d2e4decc2c6d381f7ca68751603f8/nodejs_wheel_binaries-20.16.0.tar.gz"
sha256 "85649da01bb3d0d3c9237d28545180254cda5417b4e2c219f53face0103fb2bf"
end

def install
chdir "packages/pyright" do
system "npm", "install", *Language::Node.std_npm_install_args(libexec)
end
bin.install_symlink Dir["#{libexec}/bin/*"]
virtualenv_install_with_resources
end

test do

Check warning on line 24 in Formula/basedpyright.rb

View workflow job for this annotation

GitHub Actions / test-bot (ubuntu-latest)

`brew test --verbose nikaro/tap/basedpyright` failed on Linux!

/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/bin/bundle clean ==> Testing nikaro/tap/basedpyright ==> /home/linuxbrew/.linuxbrew/Cellar/basedpyright/1.15.1_1/bin/pyright broken.py 2>&1 Error: nikaro/tap/basedpyright: failed ::error::nikaro/tap/basedpyright: failed An exception occurred within a child process: Minitest::Assertion: Expected /error:\ Expression\ of\ type\ "int"\ is\ incompatible\ with\ return\ type\ "str"/ to match "sh: 1: /home/linuxbrew/.linuxbrew/Cellar/basedpyright/1.15.1_1/bin/pyright: not found\n". /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/minitest-5.24.1/lib/minitest/assertions.rb:183:in `assert' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/minitest-5.24.1/lib/minitest/assertions.rb:297:in `assert_match' /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/nikaro/homebrew-tap/Formula/basedpyright.rb:35:in `block in <class:Basedpyright>' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula.rb:2800:in `block (3 levels) in run_test' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/extend/kernel.rb:534:in `with_env' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula.rb:2799:in `block (2 levels) in run_test' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula.rb:1193:in `with_logging' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula.rb:2798:in `block in run_test' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/mktemp.rb:75:in `block in run' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/mktemp.rb:75:in `chdir' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/mktemp.rb:75:in `run' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula.rb:3109:in `mktemp' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula.rb:2792:in `run_test' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/test.rb:48:in `block in <main>' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/timeout.rb:186:in `block in timeout' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/timeout.rb:41:in `handle_timeout' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/timeout.rb:195:in `timeout' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/test.rb:52:in `<main>'

Check warning on line 24 in Formula/basedpyright.rb

View workflow job for this annotation

GitHub Actions / test-bot (macos-latest)

`brew test --verbose nikaro/tap/basedpyright` failed on macOS Sonoma (14) on Apple Silicon!

/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/bin/bundle clean ==> Testing nikaro/tap/basedpyright ==> /opt/homebrew/Cellar/basedpyright/1.15.1_1/bin/pyright broken.py 2>&1 Error: nikaro/tap/basedpyright: failed ::error::nikaro/tap/basedpyright: failed An exception occurred within a child process: Minitest::Assertion: Expected /error:\ Expression\ of\ type\ "int"\ is\ incompatible\ with\ return\ type\ "str"/ to match "sh: /opt/homebrew/Cellar/basedpyright/1.15.1_1/bin/pyright: No such file or directory\n". /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/minitest-5.24.1/lib/minitest/assertions.rb:183:in `assert' /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/minitest-5.24.1/lib/minitest/assertions.rb:297:in `assert_match' /opt/homebrew/Library/Taps/nikaro/homebrew-tap/Formula/basedpyright.rb:35:in `block in <class:Basedpyright>' /opt/homebrew/Library/Homebrew/formula.rb:2800:in `block (3 levels) in run_test' /opt/homebrew/Library/Homebrew/extend/kernel.rb:534:in `with_env' /opt/homebrew/Library/Homebrew/formula.rb:2799:in `block (2 levels) in run_test' /opt/homebrew/Library/Homebrew/formula.rb:1193:in `with_logging' /opt/homebrew/Library/Homebrew/formula.rb:2798:in `block in run_test' /opt/homebrew/Library/Homebrew/mktemp.rb:75:in `block in run' /opt/homebrew/Library/Homebrew/mktemp.rb:75:in `chdir' /opt/homebrew/Library/Homebrew/mktemp.rb:75:in `run' /opt/homebrew/Library/Homebrew/formula.rb:3109:in `mktemp' /opt/homebrew/Library/Homebrew/formula.rb:2792:in `run_test' /opt/homebrew/Library/Homebrew/test.rb:48:in `block in <main>' /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/timeout.rb:186:in `block in timeout' /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/timeout.rb:41:in `handle_timeout' /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/timeout.rb:195:in `timeout' /opt/homebrew/Library/Homebrew/test.rb:52:in `<main>'
(testpath/"broken.py").write <<~EOS
def wrong_types(a: int, b: int) -> str:
return a + b
EOS
output = pipe_output("#{bin}/pyright broken.py 2>&1")
assert_match "error: Expression of type \"int\" is incompatible with return type \"str\"", output
end
end

0 comments on commit 0f4e872

Please sign in to comment.