homebrew-core/Formula/pari-elldata.rb

39 lines
1.5 KiB
Ruby

class PariElldata < Formula
desc "J.E. Cremona elliptic curve data for PARI/GP"
homepage "https://pari.math.u-bordeaux.fr/packages.html"
url "https://pari.math.u-bordeaux.fr/pub/pari/packages/elldata.tgz"
# Refer to http://pari.math.u-bordeaux.fr/packages.html#packages for most recent package date
version "20210301"
sha256 "dd551e64932d4ab27b3f2b2d1da871c2353672fc1a74705c52e3c0de84bd0cf6"
license "GPL-2.0-or-later"
# The only difference in the `livecheck` blocks for pari-* formulae is the
# package name in the regex and they should otherwise be kept in parity.
livecheck do
url :homepage
regex(%r{>\s*elldata\.t[^<]+?</a>(?:[&(.;\s\w]+?(?:\),?|,))?\s*([a-z]+\s+\d{1,2},?\s+\d{4})\D}i)
strategy :page_match do |page, regex|
page.scan(regex).map { |match| Date.parse(match.first)&.strftime("%Y%m%d") }
end
end
bottle do
rebuild 1
sha256 cellar: :any_skip_relocation, all: "7ed2f57963daa0d3f904f0cb3371c47f48364a2a192ad58f9b773a6b2f6dd417"
end
depends_on "pari"
def install
(share/"pari/elldata").install Utils::Gzip.compress(*Dir["#{buildpath}/elldata/ell*"])
doc.install "elldata/README"
end
test do
expected_output = "[0, -1, 1, -10, -20, -4, -20, -79, -21, 496, 20008, -161051, -122023936/161051, " \
"Vecsmall([1]), [Vecsmall([128, -1])], [0, 0, 0, 0, 0, 0, 0, 0]]"
output = pipe_output(Formula["pari"].opt_bin/"gp -q", "ellinit(\"11a1\")").chomp
assert_equal expected_output, output
end
end