diff options
| author | Felix Bùˆnemann | 2013-07-23 11:03:29 +0200 |
|---|---|---|
| committer | Samuel John | 2013-08-08 15:13:47 +0200 |
| commit | 6c035e83bb35c448ee847a36f1dc72f9b8f76639 (patch) | |
| tree | 094324b6a5a64173222d27195a8ef7ac808d8e3d /Library/Formula | |
| parent | 4624fa0feb66268ea179393021d888597c214bcb (diff) | |
| download | homebrew-6c035e83bb35c448ee847a36f1dc72f9b8f76639.tar.bz2 | |
New formula zpython: Zsh Python Module
This formula provides a zsh python module that allows executing python
as a zsh builtin. Its current main purpose is speeding up heavy
prompts like powerline.
It requires at least zsh 5.x.
More info: http://www.zsh.org/mla/workers/2013/msg00089.html
Closes #20182.
Signed-off-by: Samuel John <github@SamuelJohn.de>
Diffstat (limited to 'Library/Formula')
| -rw-r--r-- | Library/Formula/zpython.rb | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/Library/Formula/zpython.rb b/Library/Formula/zpython.rb new file mode 100644 index 000000000..3506e497b --- /dev/null +++ b/Library/Formula/zpython.rb @@ -0,0 +1,65 @@ +require 'formula' + +class Zsh5Installed < Requirement + default_formula 'zsh' + fatal true + + satisfy :build_env => false do + `zsh --version`[/zsh (\d)/, 1] == "5" rescue false + end + + def message + "Zsh 5.x is required to install." + end +end + +class Zpython < Formula + homepage 'https://bitbucket.org/ZyX_I/zsh' + url 'http://www.zsh.org/pub/zsh-5.0.2.tar.bz2' + mirror 'http://sourceforge.net/projects/zsh/files/zsh/5.0.2/zsh-5.0.2.tar.bz2' + sha1 '9f55ecaaae7cdc1495f91237ba2ec087777a4ad9' + + head 'https://bitbucket.org/ZyX_I/zsh.git', :branch => 'zpython' + + depends_on Zsh5Installed + depends_on :python + depends_on :autoconf => :build + + def patches + {:p1 => "https://gist.github.com/felixbuenemann/5790777/raw/cb5ea3b34617174e50fd3972792ec0944959de3c/zpython.patch"} + end unless build.head? + + def install + args = %W[ + --disable-gdbm + --enable-zpython + ] + + 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 + + def test + 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: + + module_path=($module_path #{HOMEBREW_PREFIX}/lib/zpython) + + 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 |
