133 lines
5.8 KiB
Ruby
133 lines
5.8 KiB
Ruby
class Ocrmypdf < Formula
|
|
include Language::Python::Virtualenv
|
|
|
|
desc "Adds an OCR text layer to scanned PDF files"
|
|
homepage "https://github.com/jbarlow83/OCRmyPDF"
|
|
url "https://files.pythonhosted.org/packages/b8/d6/da130fa5982df1e0141c0f9362ac743ec6cc724da2fa9a199661df73b998/ocrmypdf-13.4.0.tar.gz"
|
|
sha256 "e5a882afe9e1eb5382c916f13649dcab03035546f34d4bf1487d561081cb662c"
|
|
license "MPL-2.0"
|
|
|
|
bottle do
|
|
sha256 cellar: :any, arm64_monterey: "d09337bd2e19019031dfab9034836192eccfcdd4998703450f02027cf8592a9b"
|
|
sha256 cellar: :any, arm64_big_sur: "42508104400020c7e2d4445cc42a240105b02bd3900d1442a11956f488ffea78"
|
|
sha256 cellar: :any, monterey: "0540b307e9057eceec9cc009dfca673cd40d55a51f8a4e6ccb96f4e061897abe"
|
|
sha256 cellar: :any, big_sur: "eb8cac2bdbd4994cedbfadc93520a4f42d97cda02346bb2b481a062a67f00c73"
|
|
sha256 cellar: :any, catalina: "f17508fe3814383318888334e77a6a2182972e64cef28a44f1929d45731dbae9"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "227f51cf20b5784a099eb8a79a4f0c2f7b37a8ffab5b251ae60cff6afc7fa179"
|
|
end
|
|
|
|
depends_on "pkg-config" => :build
|
|
depends_on "rust" => :build
|
|
depends_on "ghostscript"
|
|
depends_on "jbig2enc"
|
|
depends_on "libffi"
|
|
depends_on "libpng"
|
|
depends_on "pillow"
|
|
depends_on "pngquant"
|
|
depends_on "pybind11"
|
|
depends_on "python@3.9"
|
|
depends_on "qpdf"
|
|
depends_on "tesseract"
|
|
depends_on "unpaper"
|
|
|
|
uses_from_macos "libxml2"
|
|
uses_from_macos "libxslt"
|
|
|
|
on_linux do
|
|
depends_on "gcc"
|
|
end
|
|
|
|
fails_with gcc: "5"
|
|
|
|
resource "cffi" do
|
|
url "https://files.pythonhosted.org/packages/00/9e/92de7e1217ccc3d5f352ba21e52398372525765b2e0c4530e6eb2ba9282a/cffi-1.15.0.tar.gz"
|
|
sha256 "920f0d66a896c2d99f0adbb391f990a84091179542c205fa53ce5787aff87954"
|
|
end
|
|
|
|
resource "chardet" do
|
|
url "https://files.pythonhosted.org/packages/ee/2d/9cdc2b527e127b4c9db64b86647d567985940ac3698eeabc7ffaccb4ea61/chardet-4.0.0.tar.gz"
|
|
sha256 "0d6f53a15db4120f2b08c94f11e7d93d2c911ee118b6b30a04ec3ee8310179fa"
|
|
end
|
|
|
|
resource "coloredlogs" do
|
|
url "https://files.pythonhosted.org/packages/cc/c7/eed8f27100517e8c0e6b923d5f0845d0cb99763da6fdee00478f91db7325/coloredlogs-15.0.1.tar.gz"
|
|
sha256 "7c991aa71a4577af2f82600d8f8f3a89f936baeaf9b50a9c197da014e5bf16b0"
|
|
end
|
|
|
|
resource "cryptography" do
|
|
url "https://files.pythonhosted.org/packages/f9/4b/1cf8e281f7ae4046a59e5e39dd7471d46db9f61bb564fddbff9084c4334f/cryptography-36.0.1.tar.gz"
|
|
sha256 "53e5c1dc3d7a953de055d77bef2ff607ceef7a2aac0353b5d630ab67f7423638"
|
|
end
|
|
|
|
resource "humanfriendly" do
|
|
url "https://files.pythonhosted.org/packages/cc/3f/2c29224acb2e2df4d2046e4c73ee2662023c58ff5b113c4c1adac0886c43/humanfriendly-10.0.tar.gz"
|
|
sha256 "6b0b831ce8f15f7300721aa49829fc4e83921a9a301cc7f606be6686a2288ddc"
|
|
end
|
|
|
|
resource "img2pdf" do
|
|
url "https://files.pythonhosted.org/packages/3c/b2/0483a18ae81c99ceccffb7482b26262f01eec8dee00bb63c0546ef27789e/img2pdf-0.4.3.tar.gz"
|
|
sha256 "8e51c5043efa95d751481b516071a006f87c2a4059961a9ac43ec238915de09f"
|
|
end
|
|
|
|
resource "lxml" do
|
|
url "https://files.pythonhosted.org/packages/3b/94/e2b1b3bad91d15526c7e38918795883cee18b93f6785ea8ecf13f8ffa01e/lxml-4.8.0.tar.gz"
|
|
sha256 "f63f62fc60e6228a4ca9abae28228f35e1bd3ce675013d1dfb828688d50c6e23"
|
|
end
|
|
|
|
resource "packaging" do
|
|
url "https://files.pythonhosted.org/packages/df/9e/d1a7217f69310c1db8fdf8ab396229f55a699ce34a203691794c5d1cad0c/packaging-21.3.tar.gz"
|
|
sha256 "dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb"
|
|
end
|
|
|
|
resource "pdfminer.six" do
|
|
url "https://files.pythonhosted.org/packages/ac/0a/b01677bb31bd79756f05ff3e052ad369ac0ebb2e64b47fc6d6bad290d981/pdfminer.six-20211012.tar.gz"
|
|
sha256 "0351f17d362ee2d48b158be52bcde6576d96460efd038a3e89a043fba6d634d7"
|
|
end
|
|
|
|
resource "pikepdf" do
|
|
url "https://files.pythonhosted.org/packages/2a/12/11349bb3789fa5120691c2c2da11dfe3cc2b9bc4ee538c4745c5477b68ec/pikepdf-5.0.1.tar.gz"
|
|
sha256 "5fae9eeb7a0120d466fb219aea643a94a1423d68ee9171639a44cf0329ebe7aa"
|
|
end
|
|
|
|
resource "pluggy" do
|
|
url "https://files.pythonhosted.org/packages/a1/16/db2d7de3474b6e37cbb9c008965ee63835bba517e22cdb8c35b5116b5ce1/pluggy-1.0.0.tar.gz"
|
|
sha256 "4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159"
|
|
end
|
|
|
|
resource "pycparser" do
|
|
url "https://files.pythonhosted.org/packages/5e/0b/95d387f5f4433cb0f53ff7ad859bd2c6051051cebbb564f139a999ab46de/pycparser-2.21.tar.gz"
|
|
sha256 "e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206"
|
|
end
|
|
|
|
resource "pyparsing" do
|
|
url "https://files.pythonhosted.org/packages/d6/60/9bed18f43275b34198eb9720d4c1238c68b3755620d20df0afd89424d32b/pyparsing-3.0.7.tar.gz"
|
|
sha256 "18ee9022775d270c55187733956460083db60b37d0d0fb357445f3094eed3eea"
|
|
end
|
|
|
|
resource "reportlab" do
|
|
url "https://files.pythonhosted.org/packages/53/2f/a445108d4386ea996da5d808231a72f7e8ef353a4df7f486aa3d39883130/reportlab-3.6.7.tar.gz"
|
|
sha256 "d035054724278129aba2a55c3edd6111b07e625ad1ff845e3ba2a5e4e203bbc8"
|
|
end
|
|
|
|
resource "tqdm" do
|
|
url "https://files.pythonhosted.org/packages/e3/c1/b3e42d5b659ca598508e2a9ef315d5eef0a970f874ef9d3b38d4578765bd/tqdm-4.62.3.tar.gz"
|
|
sha256 "d359de7217506c9851b7869f3708d8ee53ed70a1b8edbba4dbcb47442592920d"
|
|
end
|
|
|
|
def install
|
|
# Fix "ld: file not found: /usr/lib/system/libsystem_darwin.dylib" for lxml
|
|
ENV["SDKROOT"] = MacOS.sdk_path if MacOS.version == :sierra
|
|
|
|
virtualenv_install_with_resources
|
|
|
|
bash_completion.install "misc/completion/ocrmypdf.bash" => "ocrmypdf"
|
|
fish_completion.install "misc/completion/ocrmypdf.fish"
|
|
end
|
|
|
|
test do
|
|
system "#{bin}/ocrmypdf", "-f", "-q", "--deskew",
|
|
test_fixtures("test.pdf"), "ocr.pdf"
|
|
assert_predicate testpath/"ocr.pdf", :exist?
|
|
end
|
|
end
|