2015-04-11 18:16:46 +00:00
|
|
|
class Zsh5Requirement < Requirement
|
2015-04-19 10:29:55 +00:00
|
|
|
default_formula "zsh"
|
2013-07-23 09:03:29 +00:00
|
|
|
fatal true
|
|
|
|
|
|
|
|
satisfy :build_env => false do
|
2015-04-19 10:29:55 +00:00
|
|
|
begin
|
|
|
|
`zsh --version`[/zsh (\d)/, 1] == "5"
|
|
|
|
rescue
|
|
|
|
false
|
|
|
|
end
|
2013-07-23 09:03:29 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def message
|
2013-08-08 14:01:07 +00:00
|
|
|
"Zsh 5.x is required to install. Consider `brew install zsh`."
|
2013-07-23 09:03:29 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class Zpython < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Embeds a Python interpreter into zsh"
|
2015-04-19 10:29:55 +00:00
|
|
|
homepage "https://bitbucket.org/ZyX_I/zsh"
|
2014-03-17 19:44:00 +00:00
|
|
|
|
|
|
|
stable do
|
|
|
|
url "https://downloads.sourceforge.net/project/zsh/zsh/5.0.5/zsh-5.0.5.tar.bz2"
|
|
|
|
mirror "http://www.zsh.org/pub/zsh-5.0.5.tar.bz2"
|
|
|
|
|
|
|
|
# Note, non-head version is completly implemented in this lengthy patch
|
|
|
|
# later on, we hope to use https://bitbucket.org/ZyX_I/zsh.git to download a tagged release.
|
|
|
|
patch do
|
2014-04-26 19:48:32 +00:00
|
|
|
url "https://gist.githubusercontent.com/felixbuenemann/5790777/raw/cb5ea3b34617174e50fd3972792ec0944959de3c/zpython.patch"
|
2015-08-03 12:55:31 +00:00
|
|
|
sha256 "73d6565536abe269cc7715e5200ba63000b7fb830c8975db7e5e6db2222e8f09"
|
2014-03-17 19:44:00 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-08-08 14:01:07 +00:00
|
|
|
# We prepend `00-` for the first version of the zpython module, which is
|
2015-04-19 10:29:55 +00:00
|
|
|
# itself a patch on top of zsh and does not have own version number yet.
|
2013-08-08 14:01:07 +00:00
|
|
|
# Hoping that upstream will provide tags that we could download properly.
|
|
|
|
# Starting here with `00-`, so that once we get tags for the upstream
|
|
|
|
# repository at https://bitbucket.org/ZyX_I/zsh.git, brew outdated will
|
|
|
|
# be able to tell us to upgrade zpython.
|
2015-04-19 10:29:55 +00:00
|
|
|
version "00-5.0.5"
|
|
|
|
sha256 "6624d2fb6c8fa4e044d2b009f86ed1617fe8583c83acfceba7ec82826cfa8eaf"
|
2013-07-23 09:03:29 +00:00
|
|
|
|
2015-04-19 10:29:55 +00:00
|
|
|
head "https://bitbucket.org/ZyX_I/zsh.git", :branch => "zpython"
|
2013-07-23 09:03:29 +00:00
|
|
|
|
2015-04-11 18:16:46 +00:00
|
|
|
depends_on Zsh5Requirement
|
2014-05-23 21:17:35 +00:00
|
|
|
depends_on "autoconf" => :build
|
2013-07-23 09:03:29 +00:00
|
|
|
|
|
|
|
def install
|
|
|
|
args = %W[
|
|
|
|
--disable-gdbm
|
|
|
|
--enable-zpython
|
2014-02-19 04:16:15 +00:00
|
|
|
--with-tcsetpgrp
|
2013-07-23 09:03:29 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
system "autoreconf"
|
|
|
|
system "./configure", *args
|
|
|
|
|
|
|
|
# Disable building docs due to exotic yodl dependency
|
|
|
|
inreplace "Makefile", "subdir in Src Doc;", "subdir in Src;"
|
|
|
|
|
|
|
|
system "make"
|
|
|
|
(lib/"zpython/zsh").install "Src/Modules/zpython.so"
|
|
|
|
end
|
|
|
|
|
2013-08-08 14:01:07 +00:00
|
|
|
test do
|
2013-07-23 09:03:29 +00:00
|
|
|
system "zsh -c 'MODULE_PATH=#{HOMEBREW_PREFIX}/lib/zpython zmodload zsh/zpython && zpython print'"
|
|
|
|
end
|
|
|
|
|
|
|
|
def caveats; <<-EOS.undent
|
|
|
|
To use the zpython module in zsh you need to
|
|
|
|
add the following line to your .zshrc:
|
|
|
|
|
2013-08-08 14:01:07 +00:00
|
|
|
module_path=($module_path #{HOMEBREW_PREFIX}/lib/zpython)
|
2013-07-23 09:03:29 +00:00
|
|
|
|
|
|
|
If you want to use this with powerline, make sure you set
|
|
|
|
it early in .zshrc, before your prompt gets initialized.
|
|
|
|
|
|
|
|
After reloading your shell you can test with:
|
|
|
|
zmodload zsh/zpython && zpython 'print "hello world"'
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
end
|