homebrew-core/Formula/urh.rb
2017-12-16 12:50:12 -08:00

70 lines
2.7 KiB
Ruby

class Urh < Formula
desc "Universal Radio Hacker"
homepage "https://github.com/jopohl/urh"
url "https://files.pythonhosted.org/packages/83/7f/c950206b46aad12af5a8c0d055b85a107151d3089534b81c230e18067b87/urh-1.9.0.tar.gz"
sha256 "ccbfdd6c8a866dcd83164d32a904502ba4640bcedf1068ff184a1fd50f98f4a7"
head "https://github.com/jopohl/urh.git"
bottle do
sha256 "129b8f78370947c78a7c530c3141637bbcf3d1aad347671a452efd7a07a24954" => :high_sierra
sha256 "2d369dcca48d5a9ccfbada89ff51b275cb4f028cecf255483981a2bc38ff9948" => :sierra
sha256 "b4ea6bdbef8b6961fb70caf39636e0a48f7e67066c544cd7832455810e98a078" => :el_capitan
end
option "with-hackrf", "Build with libhackrf support"
depends_on "pkg-config" => :build
depends_on :python3
depends_on "pyqt"
depends_on "hackrf" => :optional
resource "numpy" do
url "https://files.pythonhosted.org/packages/bf/2d/005e45738ab07a26e621c9c12dc97381f372e06678adf7dc3356a69b5960/numpy-1.13.3.zip"
sha256 "36ee86d5adbabc4fa2643a073f93d5504bdfed37a149a3a49f4dde259f35a750"
end
resource "psutil" do
url "https://files.pythonhosted.org/packages/54/24/aa854703715fa161110daa001afce75d21d1840e9ab5eb28708d6a5058b0/psutil-5.4.2.tar.gz"
sha256 "00a1f9ff8d1e035fba7bfdd6977fa8ea7937afdb4477339e5df3dba78194fe11"
end
resource "pyzmq" do
url "https://files.pythonhosted.org/packages/1e/f9/d0675409c11d11e549e3da000901cfaabd848da117390ee00030e14bfdb6/pyzmq-16.0.3.tar.gz"
sha256 "8a883824147523c0fe76d247dd58994c1c28ef07f1cc5dde595a4fd1c28f2580"
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 = [1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1]
assert(expected == c.crc([1, 2, 3]).tolist())
EOS
system "python3", "test.py"
end
end