71 lines
2.7 KiB
Ruby
71 lines
2.7 KiB
Ruby
class Urh < Formula
|
|
desc "Universal Radio Hacker"
|
|
homepage "https://github.com/jopohl/urh"
|
|
url "https://files.pythonhosted.org/packages/08/6b/00fc66ea878a26ff054562552bb9b966fc5bec8d7df1fc52134b6431af76/urh-2.8.9.tar.gz"
|
|
sha256 "d3cdc2612f5039b40cfccfb99e2ae7311cd1cd27011c857e0aec99b150c93919"
|
|
license "GPL-3.0"
|
|
revision 2
|
|
head "https://github.com/jopohl/urh.git"
|
|
|
|
livecheck do
|
|
url :stable
|
|
end
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "b9bee49e954482216177eeb5d489c0ef552204ed0f1d4c5331d3f133d332f8c7" => :catalina
|
|
sha256 "bd9bad9dd91efb3ed22e5a522a41cdf8a78cd519fcdd8903a165ff8e27f15249" => :mojave
|
|
sha256 "a84bae547c870e05976d3d4bccc1d3df30026a30b26dd5084a06296429b654d5" => :high_sierra
|
|
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/aa/3e/d18f2c04cf2b528e18515999b0c8e698c136db78f62df34eee89cee205f1/psutil-5.7.2.tar.gz"
|
|
sha256 "90990af1c3c67195c44c9a889184f84f5b2320dce3ee3acbd054e3ba0b4a7beb"
|
|
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
|