homebrew-core/Formula/itstool.rb
2019-09-30 17:26:04 +02:00

42 lines
1.6 KiB
Ruby

class Itstool < Formula
desc "Make XML documents translatable through PO files"
homepage "http://itstool.org/"
url "https://github.com/itstool/itstool/archive/2.0.6.tar.gz"
sha256 "bda0b08e9a1db885c9d7d1545535e9814dd8931d5b8dd5ab4a47bd769d0130c6"
head "https://github.com/itstool/itstool.git"
bottle do
cellar :any_skip_relocation
sha256 "101989cf03766c6b134c806a287247452f15509c9609eeed64eb4456f7a06666" => :catalina
sha256 "460851d054248b512c108b4f8b47731ee90fcb69b179a661f721efe8fa67bf60" => :mojave
sha256 "460851d054248b512c108b4f8b47731ee90fcb69b179a661f721efe8fa67bf60" => :high_sierra
sha256 "51db63307742cfe60ffe561c00b995390b5b908655c95d996c2a33a2dd9486d2" => :sierra
end
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libxml2"
depends_on "python"
def install
xy = Language::Python.major_minor_version "python3"
ENV.append_path "PYTHONPATH", "#{Formula["libxml2"].opt_lib}/python#{xy}/site-packages"
system "./autogen.sh", "--prefix=#{libexec}",
"PYTHON=#{Formula["python"].opt_bin}/python3"
system "make", "install"
bin.install Dir["#{libexec}/bin/*"]
bin.env_script_all_files(libexec/"bin", :PYTHONPATH => ENV["PYTHONPATH"])
pkgshare.install_symlink libexec/"share/itstool/its"
man1.install_symlink libexec/"share/man/man1/itstool.1"
end
test do
(testpath/"test.xml").write <<~EOS
<tag>Homebrew</tag>
EOS
system bin/"itstool", "-o", "test.pot", "test.xml"
assert_match "msgid \"Homebrew\"", File.read("test.pot")
end
end