numpy 1.17.1
This commit is contained in:
parent
306d7f8d65
commit
ef104fce8c
1 changed files with 15 additions and 54 deletions
|
@ -1,9 +1,8 @@
|
|||
class Numpy < Formula
|
||||
desc "Package for scientific computing with Python"
|
||||
homepage "https://www.numpy.org/"
|
||||
url "https://files.pythonhosted.org/packages/d3/4b/f9f4b96c0b1ba43d28a5bdc4b64f0b9d3fbcf31313a51bc766942866a7c7/numpy-1.16.4.zip"
|
||||
sha256 "7242be12a58fec245ee9734e625964b97cf7e3f2f7d016603f9e56660ce479c7"
|
||||
revision 1
|
||||
url "https://files.pythonhosted.org/packages/cb/79/96df883cd6df0c86cb010e6f4ff790b7a30a45016a9509c94ea72c8695cd/numpy-1.17.1.zip"
|
||||
sha256 "f11331530f0eff69a758d62c2461cd98cdc2eae0147279d8fc86e0464eb7e8ca"
|
||||
head "https://github.com/numpy/numpy.git"
|
||||
|
||||
bottle do
|
||||
|
@ -14,20 +13,10 @@ class Numpy < Formula
|
|||
sha256 "cf613a9b5dc6bada1ed950b242283a9faf6c215b50a15e007047d13e26379ead" => :sierra
|
||||
end
|
||||
|
||||
depends_on "cython" => :build
|
||||
depends_on "gcc" => :build # for gfortran
|
||||
depends_on "openblas"
|
||||
depends_on "python"
|
||||
depends_on "python@2"
|
||||
|
||||
resource "Cython" do
|
||||
url "https://files.pythonhosted.org/packages/a5/1f/c7c5450c60a90ce058b47ecf60bb5be2bfe46f952ed1d3b95d1d677588be/Cython-0.29.13.tar.gz"
|
||||
sha256 "c29d069a4a30f472482343c866f7486731ad638ef9af92bfe5fca9c7323d638e"
|
||||
end
|
||||
|
||||
resource "nose" do
|
||||
url "https://files.pythonhosted.org/packages/58/a5/0dc93c3ec33f4e281849523a5a913fa1eea9a3068acfa754d44d88107a44/nose-1.3.7.tar.gz"
|
||||
sha256 "f1bffef9cbc82628f6e7d7b40d7e255aefaa1adb6a1b1d26c69a8b79e6208a98"
|
||||
end
|
||||
|
||||
def install
|
||||
openblas = Formula["openblas"].opt_prefix
|
||||
|
@ -43,49 +32,21 @@ class Numpy < Formula
|
|||
|
||||
Pathname("site.cfg").write config
|
||||
|
||||
["python2", "python3"].each do |python|
|
||||
version = Language::Python.major_minor_version python
|
||||
dest_path = lib/"python#{version}/site-packages"
|
||||
dest_path.mkpath
|
||||
version = Language::Python.major_minor_version "python3"
|
||||
ENV.prepend_create_path "PYTHONPATH", Formula["cython"].opt_libexec/"lib/python#{version}/site-packages"
|
||||
|
||||
nose_path = libexec/"nose/lib/python#{version}/site-packages"
|
||||
resource("nose").stage do
|
||||
system python, *Language::Python.setup_install_args(libexec/"nose")
|
||||
(dest_path/"homebrew-numpy-nose.pth").write "#{nose_path}\n"
|
||||
end
|
||||
|
||||
ENV.prepend_create_path "PYTHONPATH", buildpath/"tools/lib/python#{version}/site-packages"
|
||||
resource("Cython").stage do
|
||||
system python, *Language::Python.setup_install_args(buildpath/"tools")
|
||||
end
|
||||
|
||||
system python, "setup.py",
|
||||
"build", "--fcompiler=gnu95", "--parallel=#{ENV.make_jobs}",
|
||||
"install", "--prefix=#{prefix}",
|
||||
"--single-version-externally-managed", "--record=installed.txt"
|
||||
end
|
||||
end
|
||||
|
||||
def caveats
|
||||
homebrew_site_packages = Language::Python.homebrew_site_packages
|
||||
user_site_packages = Language::Python.user_site_packages "python"
|
||||
<<~EOS
|
||||
If you use system python (that comes - depending on the OS X version -
|
||||
with older versions of numpy, scipy and matplotlib), you may need to
|
||||
ensure that the brewed packages come earlier in Python's sys.path with:
|
||||
mkdir -p #{user_site_packages}
|
||||
echo 'import sys; sys.path.insert(1, "#{homebrew_site_packages}")' >> #{user_site_packages}/homebrew.pth
|
||||
EOS
|
||||
system "python3", "setup.py",
|
||||
"build", "--fcompiler=gnu95", "--parallel=#{ENV.make_jobs}",
|
||||
"install", "--prefix=#{prefix}",
|
||||
"--single-version-externally-managed", "--record=installed.txt"
|
||||
end
|
||||
|
||||
test do
|
||||
["python2", "python3"].each do |python|
|
||||
system python, "-c", <<~EOS
|
||||
import numpy as np
|
||||
t = np.ones((3,3), int)
|
||||
assert t.sum() == 9
|
||||
assert np.dot(t, t).sum() == 27
|
||||
EOS
|
||||
end
|
||||
system "python3", "-c", <<~EOS
|
||||
import numpy as np
|
||||
t = np.ones((3,3), int)
|
||||
assert t.sum() == 9
|
||||
assert np.dot(t, t).sum() == 27
|
||||
EOS
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue