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/8d/a9/79d4311c0c356071eba57472b7f93e42807ef067563ffe3a16ab10cc1e2c/urh-2.2.2.tar.gz"
|
|
sha256 "592cd0bd3031755005fd6aef510e6e764fd9a9b49adec2f3b29da34d53595f78"
|
|
head "https://github.com/jopohl/urh.git"
|
|
|
|
bottle do
|
|
sha256 "c79c7ce04091135ee38d923225a805b57d5b4cb555b51e3972c56825889057ab" => :high_sierra
|
|
sha256 "99f7add0278c4f0a5a815af33c4e67072de7bac91f1c745df352a61dab7bdea5" => :sierra
|
|
sha256 "eb223bc74577b6b0af51df82d910f673bd44333fe2dcb9fd2f510b2e368aa1b1" => :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
|