mirror of
https://github.com/mistydemeo/tigerbrew.git
synced 2026-11-27 03:19:46 -05:00
New `depends_on :python` Dependency.
New `depends_on :python3` Dependency.
To avoid having multiple formulae with endings -py2 and -py3,
we will handle support for different pythons (2.x vs. 3.x)
in the same formula.
Further brewed vs. external python will be transparently supported.
The formula also gets a new object `python`, which is false if
no Python is available or the user has disabled it. Otherwise
it is defined and provides several support methods:
python.site_packages # the site-packages in the formula's Cellar
python.global_site_packages
python.binary # the full path to the python binary
python.prefix
python.version
python.version.major
python.version.minor
python.xy # => e.g. "python2.7"
python.incdir # includes of python
python.libdir # the python dylib library
python.pkg_config_path # used internally by brew
python.from_osx?
python.framework?
python.universal?
python.pypy?
python.standard_caveats # Text to set PYTHONPATH for python.from_osx?
python.if3then3 # => "" for 2.x and to "3" for 3.x.
Further, to avoid code duplication, `python` takes an optional
block that is run twice if the formula defines depends_on
:python AND :python3.
python do
system python, 'setup.py', "--prefix=#{prefix}"
end
Read more in the Homebrew wiki.
45 lines
1.4 KiB
Ruby
45 lines
1.4 KiB
Ruby
require 'formula'
|
|
|
|
class PyEnchant < Formula
|
|
homepage 'http://pythonhosted.org/pyenchant/'
|
|
url 'https://pypi.python.org/packages/source/p/pyenchant/pyenchant-1.6.5.tar.gz'
|
|
sha1 '6f01b8657b64e970a11945c2a9b4d6d8023997bc'
|
|
end
|
|
|
|
class Enchant < Formula
|
|
homepage 'http://www.abisource.com/projects/enchant/'
|
|
url 'http://www.abisource.com/downloads/enchant/1.6.0/enchant-1.6.0.tar.gz'
|
|
sha1 '321f9cf0abfa1937401676ce60976d8779c39536'
|
|
|
|
depends_on 'pkg-config' => :build
|
|
depends_on :python => :recommended
|
|
depends_on 'glib'
|
|
depends_on 'aspell'
|
|
|
|
def install
|
|
system "./configure", "--disable-dependency-tracking",
|
|
"--prefix=#{prefix}",
|
|
"--disable-ispell",
|
|
"--disable-myspell"
|
|
system "make install"
|
|
|
|
if build.with? 'python'
|
|
# Now we handle the python bindings from the subformulae PyEnchant
|
|
PyEnchant.new.brew do
|
|
python do
|
|
ENV['PYENCHANT_LIBRARY_PATH'] = lib/'libenchant.dylib'
|
|
system python, 'setup.py', 'install', "--prefix=#{prefix}",
|
|
'--single-version-externally-managed',
|
|
'--record=installed.txt'
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
def test
|
|
python do
|
|
system python, "-c", "import enchant; d=enchant.Dict('en_US'); print(d.suggest('homebrew'))"
|
|
end
|
|
end
|
|
end
|