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.
128 lines
2.7 KiB
Ruby
128 lines
2.7 KiB
Ruby
require 'requirement'
|
|
require 'requirements/conflict_requirement'
|
|
require 'requirements/language_module_dependency'
|
|
require 'requirements/x11_dependency'
|
|
require 'requirements/mpi_dependency'
|
|
require 'requirements/python_dependency'
|
|
|
|
class XcodeDependency < Requirement
|
|
fatal true
|
|
build true
|
|
|
|
satisfy(:build_env => false) { MacOS::Xcode.installed? }
|
|
|
|
def message; <<-EOS.undent
|
|
A full installation of Xcode.app is required to compile this software.
|
|
Installing just the Command Line Tools is not sufficent.
|
|
EOS
|
|
end
|
|
end
|
|
|
|
class MysqlDependency < Requirement
|
|
fatal true
|
|
default_formula 'mysql'
|
|
|
|
satisfy { which 'mysql_config' }
|
|
|
|
def message; <<-EOS.undent
|
|
MySQL is required to install.
|
|
|
|
You can install this with Homebrew using:
|
|
brew install mysql-connector-c
|
|
For MySQL client libraries only.
|
|
|
|
brew install mysql
|
|
For MySQL server.
|
|
|
|
Or you can use an official installer from:
|
|
http://dev.mysql.com/downloads/mysql/
|
|
EOS
|
|
end
|
|
end
|
|
|
|
class PostgresqlDependency < Requirement
|
|
fatal true
|
|
default_formula 'postgresql'
|
|
|
|
satisfy { which 'pg_config' }
|
|
|
|
def message
|
|
<<-EOS.undent
|
|
Postgres is required to install.
|
|
|
|
You can install this with Homebrew using:
|
|
brew install postgres
|
|
|
|
Or you can use an official installer from:
|
|
http://www.postgresql.org/download/macosx/
|
|
EOS
|
|
end
|
|
end
|
|
|
|
class TeXDependency < Requirement
|
|
fatal true
|
|
|
|
satisfy { which('tex') || which('latex') }
|
|
|
|
def message; <<-EOS.undent
|
|
A LaTeX distribution is required to install.
|
|
|
|
You can install MacTeX distribution from:
|
|
http://www.tug.org/mactex/
|
|
|
|
Make sure that its bin directory is in your PATH before proceeding.
|
|
|
|
You may also need to restore the ownership of Homebrew install:
|
|
sudo chown -R $USER `brew --prefix`
|
|
EOS
|
|
end
|
|
end
|
|
|
|
class CLTDependency < Requirement
|
|
fatal true
|
|
build true
|
|
|
|
satisfy(:build_env => false) { MacOS::CLT.installed? }
|
|
|
|
def message; <<-EOS.undent
|
|
The Command Line Tools for Xcode are required to compile this software.
|
|
The standalone package can be obtained from http://connect.apple.com,
|
|
or it can be installed via Xcode's preferences.
|
|
EOS
|
|
end
|
|
end
|
|
|
|
class ArchRequirement < Requirement
|
|
fatal true
|
|
|
|
def initialize(arch)
|
|
@arch = arch.pop
|
|
super
|
|
end
|
|
|
|
satisfy do
|
|
case @arch
|
|
when :x86_64 then MacOS.prefer_64_bit?
|
|
end
|
|
end
|
|
|
|
def message
|
|
"This formula requires an #{@arch} architecture."
|
|
end
|
|
end
|
|
|
|
class MercurialDependency < Requirement
|
|
fatal true
|
|
default_formula 'mercurial'
|
|
|
|
satisfy { which('hg') }
|
|
|
|
def message; <<-EOS.undent
|
|
Mercurial is needed to install this software.
|
|
|
|
You can install this with Homebrew using:
|
|
brew install mercurial
|
|
EOS
|
|
end
|
|
end
|