110 lines
5.2 KiB
Ruby
110 lines
5.2 KiB
Ruby
class Ptpython < Formula
|
|
include Language::Python::Virtualenv
|
|
|
|
desc "Advanced Python REPL"
|
|
homepage "https://github.com/prompt-toolkit/ptpython"
|
|
url "https://files.pythonhosted.org/packages/ba/0f/50bcc855141de9c0412654fbbda99afc45cdf669382feacec0f7024637e0/ptpython-3.0.17.tar.gz"
|
|
sha256 "911d25cca31a8e4f9b2ecd16dcdad793b8859e94fca1275f3485d8cdf20b13de"
|
|
license "BSD-3-Clause"
|
|
head "https://github.com/prompt-toolkit/ptpython.git"
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, arm64_big_sur: "b3c5b4b41eb2a5a59e5bae6ad55914b62d2ab55916487b239c9267706bfbe246"
|
|
sha256 cellar: :any_skip_relocation, big_sur: "dd604371be0bf62e0485cc9fe7ec8e2ab53cf1059bd0146e5895d10969ec356d"
|
|
sha256 cellar: :any_skip_relocation, catalina: "212009d12a4ea37f77ca930b11f619b8b1d784323a746701356bee9efa9bbf14"
|
|
sha256 cellar: :any_skip_relocation, mojave: "dca5a5d745e0b3ba65589149183fa67d354462b0bcf6ce4fe654a887aa85df06"
|
|
end
|
|
|
|
depends_on "python@3.9"
|
|
|
|
resource "appdirs" do
|
|
url "https://files.pythonhosted.org/packages/d7/d8/05696357e0311f5b5c316d7b95f46c669dd9c15aaeecbb48c7d0aeb88c40/appdirs-1.4.4.tar.gz"
|
|
sha256 "7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"
|
|
end
|
|
|
|
resource "black" do
|
|
url "https://files.pythonhosted.org/packages/dc/7b/5a6bbe89de849f28d7c109f5ea87b65afa5124ad615f3419e71beb29dc96/black-20.8b1.tar.gz"
|
|
sha256 "1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea"
|
|
end
|
|
|
|
resource "click" do
|
|
url "https://files.pythonhosted.org/packages/27/6f/be940c8b1f1d69daceeb0032fee6c34d7bd70e3e649ccac0951500b4720e/click-7.1.2.tar.gz"
|
|
sha256 "d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a"
|
|
end
|
|
|
|
resource "jedi" do
|
|
url "https://files.pythonhosted.org/packages/ac/11/5c542bf206efbae974294a61febc61e09d74cb5d90d8488793909db92537/jedi-0.18.0.tar.gz"
|
|
sha256 "92550a404bad8afed881a137ec9a461fed49eca661414be45059329614ed0707"
|
|
end
|
|
|
|
resource "mypy-extensions" do
|
|
url "https://files.pythonhosted.org/packages/63/60/0582ce2eaced55f65a4406fc97beba256de4b7a95a0034c6576458c6519f/mypy_extensions-0.4.3.tar.gz"
|
|
sha256 "2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"
|
|
end
|
|
|
|
resource "parso" do
|
|
url "https://files.pythonhosted.org/packages/5d/62/31ce4b24055558771af3498266852e1a89b4ca43ecec251b16122da32dbd/parso-0.8.1.tar.gz"
|
|
sha256 "8519430ad07087d4c997fda3a7918f7cfa27cb58972a8c89c2a0295a1c940e9e"
|
|
end
|
|
|
|
resource "pathspec" do
|
|
url "https://files.pythonhosted.org/packages/b7/64/e097eea8dcd2b2f7df6e4425fc98e7494e37b1a6e149603c31d327080a05/pathspec-0.8.1.tar.gz"
|
|
sha256 "86379d6b86d75816baba717e64b1a3a3469deb93bb76d613c9ce79edc5cb68fd"
|
|
end
|
|
|
|
resource "prompt-toolkit" do
|
|
url "https://files.pythonhosted.org/packages/f7/e0/47738dadee0ec15ffbfa926f01586db2397201e0af3e06a0e669adfd6f2f/prompt_toolkit-3.0.18.tar.gz"
|
|
sha256 "e1b4f11b9336a28fa11810bc623c357420f69dfdb6d2dac41ca2c21a55c033bc"
|
|
end
|
|
|
|
resource "Pygments" do
|
|
url "https://files.pythonhosted.org/packages/15/9d/bc9047ca1eee944cc245f3649feea6eecde3f38011ee9b8a6a64fb7088cd/Pygments-2.8.1.tar.gz"
|
|
sha256 "2656e1a6edcdabf4275f9a3640db59fd5de107d88e8663c5d4e9a0fa62f77f94"
|
|
end
|
|
|
|
resource "regex" do
|
|
url "https://files.pythonhosted.org/packages/84/cb/e7792d2c52f61a686ce0fabe79b3674c41238d07cd35c79b4062e9a807f6/regex-2021.3.17.tar.gz"
|
|
sha256 "4b8a1fb724904139149a43e172850f35aa6ea97fb0545244dc0b805e0154ed68"
|
|
end
|
|
|
|
resource "toml" do
|
|
url "https://files.pythonhosted.org/packages/be/ba/1f744cdc819428fc6b5084ec34d9b30660f6f9daaf70eead706e3203ec3c/toml-0.10.2.tar.gz"
|
|
sha256 "b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"
|
|
end
|
|
|
|
resource "typed-ast" do
|
|
url "https://files.pythonhosted.org/packages/36/8c/efd8ffe7d242cd389632a11cbc6ce596de49b46ece22760a67b742534368/typed_ast-1.4.2.tar.gz"
|
|
sha256 "9fc0b3cb5d1720e7141d103cf4819aea239f7d136acf9ee4a69b047b7986175a"
|
|
end
|
|
|
|
resource "typing-extensions" do
|
|
url "https://files.pythonhosted.org/packages/16/06/0f7367eafb692f73158e5c5cbca1aec798cdf78be5167f6415dd4205fa32/typing_extensions-3.7.4.3.tar.gz"
|
|
sha256 "99d4073b617d30288f569d3f13d2bd7548c3a7e4c8de87db09a9d29bb3a4a60c"
|
|
end
|
|
|
|
resource "wcwidth" do
|
|
url "https://files.pythonhosted.org/packages/89/38/459b727c381504f361832b9e5ace19966de1a235d73cdbdea91c771a1155/wcwidth-0.2.5.tar.gz"
|
|
sha256 "c4d647b99872929fdb7bdcaa4fbe7f01413ed3d98077df798530e5b04f116c83"
|
|
end
|
|
|
|
def install
|
|
venv = virtualenv_create(libexec, Formula["python@3.9"].opt_bin/"python3")
|
|
venv.pip_install resources
|
|
venv.pip_install buildpath
|
|
|
|
# Make the Homebrew site-packages available in the interpreter environment
|
|
xy = Language::Python.major_minor_version Formula["python@3.9"].opt_bin/"python3"
|
|
ENV.prepend_path "PYTHONPATH", HOMEBREW_PREFIX/"lib/python#{xy}/site-packages"
|
|
ENV.prepend_path "PYTHONPATH", libexec/"lib/python#{xy}/site-packages"
|
|
combined_pythonpath = ENV["PYTHONPATH"] + "${PYTHONPATH:+:}$PYTHONPATH"
|
|
%w[ptipython ptipython3 ptipython3.9 ptpython ptpython3 ptpython3.9].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", shell_output("#{bin}/ptpython test.py").chomp
|
|
end
|
|
end
|