66 lines
2.8 KiB
Ruby
66 lines
2.8 KiB
Ruby
class Urh < Formula
|
|
desc "Universal Radio Hacker"
|
|
homepage "https://github.com/jopohl/urh"
|
|
url "https://files.pythonhosted.org/packages/ea/ec/f091b8dd7636c1999a0cef0d6d0c5fe011e12e9a4c1809526bfa58c39197/urh-2.9.1.tar.gz"
|
|
sha256 "b93df6f8c67bbb1c08d4b837aa3783f6fa79d2bd69cb725744f9e01bd81aefe2"
|
|
license "GPL-3.0"
|
|
head "https://github.com/jopohl/urh.git"
|
|
|
|
bottle do
|
|
sha256 cellar: :any, arm64_big_sur: "f59be551336b3d01b468da371a51dc654a6833dcaf39c1f62dc3dd4e85b00aba"
|
|
sha256 cellar: :any, big_sur: "6115bada2ad182024453d7d29ea4df3e6761204a9aa5f4b598209344a7b73f48"
|
|
sha256 cellar: :any, catalina: "1f5710ff1c1c511793a55c7439162ba2869b58597c6336f4b0b0c2dc2d742f89"
|
|
sha256 cellar: :any, mojave: "048a777039cd82536d42b16a526171de0ddc982654f69008dfa33e282038c694"
|
|
end
|
|
|
|
depends_on "pkg-config" => :build
|
|
depends_on "cython"
|
|
depends_on "hackrf"
|
|
depends_on "numpy"
|
|
depends_on "pyqt"
|
|
depends_on "python@3.9"
|
|
|
|
resource "psutil" do
|
|
url "https://files.pythonhosted.org/packages/e1/b0/7276de53321c12981717490516b7e612364f2cb372ee8901bd4a66a000d7/psutil-5.8.0.tar.gz"
|
|
sha256 "0c9ccb99ab76025f2f0bbecf341d4656e9c1351db8cc8a03ccd62e318ab4b5c6"
|
|
end
|
|
|
|
def install
|
|
xy = Language::Python.major_minor_version Formula["python@3.9"].opt_bin/"python3"
|
|
ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python#{xy}/site-packages"
|
|
resources.each do |r|
|
|
r.stage do
|
|
system Formula["python@3.9"].opt_bin/"python3", *Language::Python.setup_install_args(libexec/"vendor")
|
|
end
|
|
end
|
|
|
|
ENV.prepend_create_path "PYTHONPATH", Formula["cython"].opt_libexec/"lib/python#{xy}/site-packages"
|
|
ENV.prepend_create_path "PYTHONPATH", libexec/"lib/python#{xy}/site-packages"
|
|
|
|
system Formula["python@3.9"].opt_bin/"python3", *Language::Python.setup_install_args(libexec)
|
|
|
|
bin.install Dir[libexec/"bin/*"]
|
|
bin.env_script_all_files(libexec/"bin", PYTHONPATH: ENV["PYTHONPATH"])
|
|
end
|
|
|
|
test do
|
|
xy = Language::Python.major_minor_version Formula["python@3.9"].opt_bin/"python3"
|
|
ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python#{xy}/site-packages"
|
|
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 Formula["python@3.9"].opt_bin/"python3", "test.py"
|
|
|
|
# test command-line functionality
|
|
output = shell_output("#{bin}/urh_cli -pm 0 0 -pm 1 100 -mo ASK -sps 100 -s 2e3 " \
|
|
"-m 1010111100001 -f 868.3e6 -d RTL-TCP -tx 2>/dev/null", 1)
|
|
|
|
assert_match(/Modulating/, output)
|
|
assert_match(/Successfully modulated 1 messages/, output)
|
|
end
|
|
end
|