homebrew-core/Formula/scipy.rb
2020-01-09 19:23:31 +00:00

57 lines
2 KiB
Ruby

class Scipy < Formula
desc "Software for mathematics, science, and engineering"
homepage "https://www.scipy.org"
url "https://files.pythonhosted.org/packages/04/ab/e2eb3e3f90b9363040a3d885ccc5c79fe20c5b8a3caa8fe3bf47ff653260/scipy-1.4.1.tar.gz"
sha256 "dee1bbf3a6c8f73b6b218cb28eed8dd13347ea2f87d572ce19b289d6fd3fbc59"
head "https://github.com/scipy/scipy.git"
bottle do
cellar :any
sha256 "19c0a221d401c458258d971cbc46b986a069df090cedfb1a2a0993df4aef2220" => :catalina
sha256 "e82b952d67784d5ecd51f49ccbc39debb6fa97f3d79fa042478c9bdf1aeb6f42" => :mojave
sha256 "754f650e504d31d5a91cb3dca5c3ab0ed05b929dc958c1fe05805ce976338e0b" => :high_sierra
end
depends_on "swig" => :build
depends_on "gcc" # for gfortran
depends_on "numpy"
depends_on "openblas"
depends_on "pybind11"
depends_on "python"
cxxstdlib_check :skip
def install
openblas = Formula["openblas"].opt_prefix
ENV["ATLAS"] = "None" # avoid linking against Accelerate.framework
ENV["BLAS"] = ENV["LAPACK"] = "#{openblas}/lib/libopenblas.dylib"
config = <<~EOS
[DEFAULT]
library_dirs = #{HOMEBREW_PREFIX}/lib
include_dirs = #{HOMEBREW_PREFIX}/include
[openblas]
libraries = openblas
library_dirs = #{openblas}/lib
include_dirs = #{openblas}/include
EOS
Pathname("site.cfg").write config
version = Language::Python.major_minor_version "python3"
ENV["PYTHONPATH"] = Formula["numpy"].opt_lib/"python#{version}/site-packages"
ENV.prepend_create_path "PYTHONPATH", lib/"python#{version}/site-packages"
system "python3", "setup.py", "build", "--fcompiler=gnu95"
system "python3", *Language::Python.setup_install_args(prefix)
end
# cleanup leftover .pyc files from previous installs which can cause problems
# see https://github.com/Homebrew/homebrew-python/issues/185#issuecomment-67534979
def post_install
rm_f Dir["#{HOMEBREW_PREFIX}/lib/python*.*/site-packages/scipy/**/*.pyc"]
end
test do
system "python3", "-c", "import scipy"
end
end