70 lines
2.7 KiB
Ruby
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/2d/41/1802d69821e808404e08b7e5dd238de8a05a53e6acb54be5407d764b4b77/urh-1.7.1.tar.gz"
|
|
sha256 "0a8460be8df70f0dc98bf2646aa5e3fe4ac43df38c601b184f42554f3fde411a"
|
|
head "https://github.com/jopohl/urh.git"
|
|
|
|
bottle do
|
|
sha256 "75ad76f03b9d0d5cb104ed3c5b2f7efec5a18bc9648eac75d1deee42c804afba" => :sierra
|
|
sha256 "ec3c21126d99bcd28e716ec59d060e5d7c996e04f10e566c08cd971618fe25a3" => :el_capitan
|
|
sha256 "c1ea87639181c5edf553fec441cb9c5603dbf46a7ff12f933be69bafeb4eba49" => :yosemite
|
|
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/c0/3a/40967d9f5675fbb097ffec170f59c2ba19fc96373e73ad47c2cae9a30aed/numpy-1.13.1.zip"
|
|
sha256 "c9b0283776085cb2804efff73e9955ca279ba4edafd58d3ead70b61d209c4fbb"
|
|
end
|
|
|
|
resource "psutil" do
|
|
url "https://files.pythonhosted.org/packages/57/93/47a2e3befaf194ccc3d05ffbcba2cdcdd22a231100ef7e4cf63f085c900b/psutil-5.2.2.tar.gz"
|
|
sha256 "44746540c0fab5b95401520d29eb9ffe84b3b4a235bd1d1971cbe36e1f38dd13"
|
|
end
|
|
|
|
resource "pyzmq" do
|
|
url "https://files.pythonhosted.org/packages/af/37/8e0bf3800823bc247c36715a52e924e8f8fd5d1432f04b44b8cd7a5d7e55/pyzmq-16.0.2.tar.gz"
|
|
sha256 "0322543fff5ab6f87d11a8a099c4c07dd8a1719040084b6ce9162bcdf5c45c9d"
|
|
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.undent
|
|
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
|