c7e047fc17
Closes #27547. Signed-off-by: ilovezfs <ilovezfs@icloud.com>
67 lines
2.5 KiB
Ruby
67 lines
2.5 KiB
Ruby
class Urh < Formula
|
|
desc "Universal Radio Hacker"
|
|
homepage "https://github.com/jopohl/urh"
|
|
url "https://files.pythonhosted.org/packages/2b/7f/bc9b39c6543e4e253b51787fc86cd5bddc2dedc9a044e857da8d8c276676/urh-2.0.4.tar.gz"
|
|
sha256 "9a2d019f8c07b41d42469528a8c8a4903d6113e28a3da73e8920bb5f45364380"
|
|
head "https://github.com/jopohl/urh.git"
|
|
|
|
bottle do
|
|
sha256 "e24aed36dddd23bc0d98740580f16f8e90ccb33b0ebb1dcb208c9dc0558d4515" => :high_sierra
|
|
sha256 "7a40e03eb74e40c41e2e0983b0d315f7dd04435a83a89cb1fdd2311ae217a66a" => :sierra
|
|
sha256 "afd5140b76a81e9951673d5ab107c05c3caf97a72a579d1c49885cb8907735d0" => :el_capitan
|
|
end
|
|
|
|
option "with-hackrf", "Build with libhackrf support"
|
|
|
|
depends_on "pkg-config" => :build
|
|
|
|
depends_on "numpy"
|
|
depends_on "python"
|
|
depends_on "pyqt"
|
|
depends_on "zeromq"
|
|
|
|
depends_on "hackrf" => :optional
|
|
|
|
resource "psutil" do
|
|
url "https://files.pythonhosted.org/packages/14/a2/8ac7dda36eac03950ec2668ab1b466314403031c83a95c5efc81d2acf163/psutil-5.4.5.tar.gz"
|
|
sha256 "ebe293be36bb24b95cdefc5131635496e88b17fabbcf1e4bc9b5c01f5e489cfe"
|
|
end
|
|
|
|
resource "pyzmq" do
|
|
url "https://files.pythonhosted.org/packages/9f/f6/85a33a25128a4a812c3482547e3d458eebdb19ee0b4699f9199cdb2ad731/pyzmq-17.0.0.tar.gz"
|
|
sha256 "0145ae59139b41f65e047a3a9ed11bbc36e37d5e96c64382fcdff911c4d8c3f0"
|
|
end
|
|
|
|
def install
|
|
# Workaround for https://github.com/Homebrew/brew/issues/932
|
|
ENV.delete "PYTHONPATH"
|
|
# suppress urh warning about needing to recompile the c++ extensions
|
|
inreplace "src/urh/main.py", "GENERATE_UI = True", "GENERATE_UI = False"
|
|
|
|
xy = Language::Python.major_minor_version "python3"
|
|
ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python#{xy}/site-packages"
|
|
resources.each do |r|
|
|
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"
|
|
system "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 "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
|