80 lines
3.1 KiB
Ruby
80 lines
3.1 KiB
Ruby
class Urh < Formula
|
|
desc "Universal Radio Hacker"
|
|
homepage "https://github.com/jopohl/urh"
|
|
url "https://files.pythonhosted.org/packages/8c/60/656da24f60bce991c48aa6ac6aa0c741345a91dc354618661ce907a76850/urh-2.2.0.tar.gz"
|
|
sha256 "1aa54a0a3cd29ddfb91a9b5a09890f20429c731fd25414f3262ddef79e556d33"
|
|
head "https://github.com/jopohl/urh.git"
|
|
|
|
bottle do
|
|
sha256 "9d09523dfe451d330a5c4bcf29fce0f9ad02ee5633787a465834a3913e497dd9" => :high_sierra
|
|
sha256 "8ba6461b38949d3f2790517cf70374da982bcce2489e4ba41028c5d36e9129bc" => :sierra
|
|
sha256 "e6b1a3c3159db5619b45fa134c72f34ad593f5b2873e1141b9bcbde77624db36" => :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 "Cython" do
|
|
url "https://files.pythonhosted.org/packages/b3/ae/971d3b936a7ad10e65cb7672356cff156000c5132cf406cb0f4d7a980fd3/Cython-0.28.3.tar.gz"
|
|
sha256 "1aae6d6e9858888144cea147eb5e677830f45faaff3d305d77378c3cba55f526"
|
|
end
|
|
|
|
resource "psutil" do
|
|
url "https://files.pythonhosted.org/packages/51/9e/0f8f5423ce28c9109807024f7bdde776ed0b1161de20b408875de7e030c3/psutil-5.4.6.tar.gz"
|
|
sha256 "686e5a35fe4c0acc25f3466c32e716f2d498aaae7b7edc03e2305b682226bcf6"
|
|
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|
|
|
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
|