homebrew-core/Formula/bpython.rb

102 lines
4.8 KiB
Ruby

class Bpython < Formula
include Language::Python::Virtualenv
desc "Fancy interface to the Python interpreter"
homepage "https://bpython-interpreter.org"
url "https://files.pythonhosted.org/packages/79/71/10573e8d9e1f947e330bdd77724750163dbd80245840f7e852c9fec493c4/bpython-0.23.tar.gz"
sha256 "9f0078abc887c48af088691e2f64797d6ca994ac0f4bc03c38d06f657d7c052a"
license "MIT"
head "https://github.com/bpython/bpython.git", branch: "main"
bottle do
rebuild 4
sha256 cellar: :any_skip_relocation, arm64_ventura: "e5130679e537bb21be214bb865b900e6371ce71cc7092d6f5c4f6b41a04195ad"
sha256 cellar: :any_skip_relocation, arm64_monterey: "d7b0eb79ff7e09a96920b34e9e82e2abeec1f7a57afca5cece01a381482f6996"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "046c2fd1923b244280be7848451bce1c58bb1877b49f2068ae66275141c1b23e"
sha256 cellar: :any_skip_relocation, ventura: "14cd59266dc3e75530709b89ce695807c5e5c7337aa1577ab030106fb7df49ca"
sha256 cellar: :any_skip_relocation, monterey: "7e957af13cde91deb3ffb5305b4760f5e9f9c6026ec827272c60ca982bc98d27"
sha256 cellar: :any_skip_relocation, big_sur: "4fc1046162df864a562faa4ffb0c64e4f898f0fbc0952eb86d34a69214f8de31"
sha256 cellar: :any_skip_relocation, x86_64_linux: "697e9b60b8dd7733e686dc93f19035eeafd7e72dd12f40ffa0c5fecbb999bcd0"
end
depends_on "pygments"
depends_on "python@3.11"
depends_on "six"
resource "blessed" do
url "https://files.pythonhosted.org/packages/e5/ad/97453480e7bdfce94f05a983cf7ad7f1d90239efee53d5af28e622f0367f/blessed-1.19.1.tar.gz"
sha256 "9a0d099695bf621d4680dd6c73f6ad547f6a3442fbdbe80c4b1daa1edbc492fc"
end
resource "certifi" do
url "https://files.pythonhosted.org/packages/37/f7/2b1b0ec44fdc30a3d31dfebe52226be9ddc40cd6c0f34ffc8923ba423b69/certifi-2022.12.7.tar.gz"
sha256 "35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3"
end
resource "charset-normalizer" do
url "https://files.pythonhosted.org/packages/a1/34/44964211e5410b051e4b8d2869c470ae8a68ae274953b1c7de6d98bbcf94/charset-normalizer-2.1.1.tar.gz"
sha256 "5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845"
end
resource "curtsies" do
url "https://files.pythonhosted.org/packages/4e/43/838c06297741002403835436bba88c38d0a42ed9ce3e39a61de73e4cb4d0/curtsies-0.4.1.tar.gz"
sha256 "62d10f349c553845306556a7f2663ce96b098d8c5bbc40daec7a6eedde1622b0"
end
resource "cwcwidth" do
url "https://files.pythonhosted.org/packages/c6/6c/fe4a10bd3de2a3ecdcb53e8ad90ec9fddc846342e5e39e6446c692637414/cwcwidth-0.1.8.tar.gz"
sha256 "5adc034b7c90e6a8586bd046bcbf6004e35e16b0d7e31de395513a50d729bbf6"
end
resource "greenlet" do
url "https://files.pythonhosted.org/packages/fd/6a/f07b0028baff9bca61ecfcd9ee021e7e33369da8094f00eff409f2ff32be/greenlet-2.0.1.tar.gz"
sha256 "42e602564460da0e8ee67cb6d7236363ee5e131aa15943b6670e44e5c2ed0f67"
end
resource "idna" do
url "https://files.pythonhosted.org/packages/8b/e1/43beb3d38dba6cb420cefa297822eac205a277ab43e5ba5d5c46faf96438/idna-3.4.tar.gz"
sha256 "814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"
end
resource "pyxdg" do
url "https://files.pythonhosted.org/packages/b0/25/7998cd2dec731acbd438fbf91bc619603fc5188de0a9a17699a781840452/pyxdg-0.28.tar.gz"
sha256 "3267bb3074e934df202af2ee0868575484108581e6f3cb006af1da35395e88b4"
end
resource "requests" do
url "https://files.pythonhosted.org/packages/a5/61/a867851fd5ab77277495a8709ddda0861b28163c4613b011bc00228cc724/requests-2.28.1.tar.gz"
sha256 "7c5599b102feddaa661c826c56ab4fee28bfd17f5abca1ebbe3e7f19d7c97983"
end
resource "urllib3" do
url "https://files.pythonhosted.org/packages/c2/51/32da03cf19d17d46cce5c731967bf58de9bd71db3a379932f53b094deda4/urllib3-1.26.13.tar.gz"
sha256 "c083dd0dce68dbfbe1129d5271cb90f9447dea7d52097c6e0126120c521ddea8"
end
resource "wcwidth" do
url "https://files.pythonhosted.org/packages/89/38/459b727c381504f361832b9e5ace19966de1a235d73cdbdea91c771a1155/wcwidth-0.2.5.tar.gz"
sha256 "c4d647b99872929fdb7bdcaa4fbe7f01413ed3d98077df798530e5b04f116c83"
end
def install
python3 = "python3.11"
venv = virtualenv_create(libexec, python3)
venv.pip_install resources
venv.pip_install buildpath
# Make the Homebrew site-packages available in the interpreter environment
site_packages = Language::Python.site_packages(python3)
ENV.prepend_path "PYTHONPATH", HOMEBREW_PREFIX/site_packages
ENV.prepend_path "PYTHONPATH", libexec/site_packages
combined_pythonpath = ENV["PYTHONPATH"] + "${PYTHONPATH:+:}$PYTHONPATH"
%w[bpdb bpython].each do |cmd|
(bin/cmd).write_env_script libexec/"bin/#{cmd}", PYTHONPATH: combined_pythonpath
end
end
test do
(testpath/"test.py").write "print(2+2)\n"
assert_equal "4\n", shell_output("#{bin}/bpython test.py")
end
end