homebrew-core/Formula/urh.rb
2019-10-22 16:28:54 -04:00

72 lines
2.8 KiB
Ruby

class Urh < Formula
desc "Universal Radio Hacker"
homepage "https://github.com/jopohl/urh"
url "https://files.pythonhosted.org/packages/53/34/217173671fb93543e692f6e21374618aeaa367d054632a9fb7b4ed946d0b/urh-2.8.0.tar.gz"
sha256 "52124d348052d5921871cccb7d13d869b29c9d48b3da861191aea27976da1965"
head "https://github.com/jopohl/urh.git"
bottle do
sha256 "75f6c9bd0d20973a6dbfffae5cab957d6fa9dabf6edfcd920e2104f13d225e76" => :catalina
sha256 "1c7c16a5b6999491ad09035ed52fa6c358157911c8b5bbcc1a06c2bcbf26c573" => :mojave
sha256 "d982e78ded4a79c835bc99f267b5ce565c05a527953a3172e8913a3ee05ce263" => :high_sierra
end
depends_on "pkg-config" => :build
depends_on "hackrf"
depends_on "numpy"
depends_on "pyqt"
depends_on "python"
depends_on "zeromq"
resource "Cython" do
url "https://files.pythonhosted.org/packages/a5/1f/c7c5450c60a90ce058b47ecf60bb5be2bfe46f952ed1d3b95d1d677588be/Cython-0.29.13.tar.gz"
sha256 "c29d069a4a30f472482343c866f7486731ad638ef9af92bfe5fca9c7323d638e"
end
resource "psutil" do
url "https://files.pythonhosted.org/packages/1c/ca/5b8c1fe032a458c2c4bcbe509d1401dca9dda35c7fc46b36bb81c2834740/psutil-5.6.3.tar.gz"
sha256 "863a85c1c0a5103a12c05a35e59d336e1d665747e531256e061213e2e90f63f3"
end
resource "pyzmq" do
url "https://files.pythonhosted.org/packages/7a/d2/1eb3a994374802b352d4911f3317313a5b4ea786bc830cc5e343dad9b06d/pyzmq-18.1.0.tar.gz"
sha256 "93f44739db69234c013a16990e43db1aa0af3cf5a4b8b377d028ff24515fbeb3"
end
def install
xy = Language::Python.major_minor_version "python3"
ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python#{xy}/site-packages"
resources.each do |r|
next if r.name == "Cython"
r.stage do
system "python3", *Language::Python.setup_install_args(libexec/"vendor")
end
end
ENV.prepend_create_path "PYTHONPATH", libexec/"lib/python#{xy}/site-packages"
saved_python_path = ENV["PYTHONPATH"]
ENV.prepend_create_path "PYTHONPATH", buildpath/"cython/lib/python#{xy}/site-packages"
resource("Cython").stage do
system "python3", *Language::Python.setup_install_args(buildpath/"cython")
end
system "python3", *Language::Python.setup_install_args(libexec)
bin.install Dir[libexec/"bin/*"]
bin.env_script_all_files(libexec/"bin", :PYTHONPATH => saved_python_path)
end
test do
xy = Language::Python.major_minor_version "python3"
ENV.prepend_create_path "PYTHONPATH", libexec/"lib/python#{xy}/site-packages"
(testpath/"test.py").write <<~EOS
from urh.util.GenericCRC import GenericCRC;
c = GenericCRC();
expected = [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0]
assert(expected == c.crc([0, 1, 0, 1, 1, 0, 1, 0]).tolist())
EOS
system "python3", "test.py"
end
end