-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscalene.rb
46 lines (37 loc) · 1.09 KB
/
scalene.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# typed: false
# frozen_string_literal: true
##
# Scalene formula for Homebrew.
class Scalene < Formula
##
# Installs Scalene script and libraries.
desc "High-performance CPU, GPU and memory profiler for Python"
homepage "https://github.com/plasma-umass/scalene"
version "1.5.32.1"
license "Apache-2.0"
depends_on "python" => :build
stable do
url "https://github.com/plasma-umass/scalene.git", revision: "e05b4519ddde383f0e46d3209ac8799f8e79341e"
end
head do
url "https://github.com/plasma-umass/scalene.git", branch: "master"
end
def install
system "make"
lib.install "scalene/libscalene.dylib"
# Install the Scalene Python package
system "python3", "-m", "pip", "install", "-e", "."
(buildpath/"runner_script").write(runner_script)
bin.install "runner_script" => "scalene"
end
test do
puts "Testing..."
system "scalene"
end
def runner_script
<<~EOS
#!/usr/bin/env sh
OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES DYLD_INSERT_LIBRARIES=#{lib}/libscalene.dylib PYTHONMALLOC=malloc python3 -m scalene "$@"
EOS
end
end