Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tccutil 1.2.13 #140587

Merged
merged 2 commits into from
Aug 28, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 29 additions & 9 deletions Formula/t/tccutil.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
class Tccutil < Formula
include Language::Python::Shebang

desc "Utility to modify the macOS Accessibility Database (TCC.db)"
homepage "https://github.com/jacobsalmela/tccutil"
url "https://github.com/jacobsalmela/tccutil/archive/v1.2.11.tar.gz"
sha256 "efff442bc4d1b50ededa0798c9e3a6a881ac3d06310148cf438d5e531f9d6564"
url "https://github.com/jacobsalmela/tccutil/archive/v1.2.13.tar.gz"
sha256 "b0e3f660857426372588b0f659056a059ccbd35a4c91538c75671d960cb91030"
license "GPL-2.0-or-later"
head "https://github.com/jacobsalmela/tccutil.git", branch: "main"

Expand All @@ -14,18 +16,36 @@ class Tccutil < Formula
depends_on :macos
depends_on "[email protected]"

def python
deps.first.to_formula
resource "flit-core" do
url "https://files.pythonhosted.org/packages/c4/e6/c1ac50fe3eebb38a155155711e6e864e254ce4b6e17fe2429b4c4d5b9e80/flit_core-3.9.0.tar.gz"
sha256 "72ad266176c4a3fcfab5f2930d76896059851240570ce9a98733b658cb786eba"
end

resource "packaging" do
url "https://files.pythonhosted.org/packages/b9/6c/7c6658d258d7971c5eb0d9b69fa9265879ec9a9158031206d47800ae2213/packaging-23.1.tar.gz"
sha256 "a392980d2b6cffa644431898be54b0045151319d1e7ec34f0cfed48767dd334f"
end

def python3
which("python3.11")
end

def install
prefix.install_metafiles
libexec.install "tccutil.py"
(bin/"tccutil").write_env_script libexec/"tccutil.py", PATH: "#{python.opt_libexec}/bin:$PATH"
ENV.prepend_create_path "PYTHONPATH", libexec/"vendor"/Language::Python.site_packages(python3)

resources.each do |r|
r.stage do
system python3, "-m", "pip", "install", *std_pip_args(prefix: libexec/"vendor"), "."
end
end

rewrite_shebang detected_python_shebang, "tccutil.py"
bin.install "tccutil.py" => "tccutil"
bin.env_script_all_files(libexec/"bin", PYTHONPATH: ENV["PYTHONPATH"])
end

test do
ENV.prepend_path "PATH", python.opt_libexec/"bin"
system "#{bin}/tccutil", "--help"
assert_match "Unrecognized command check", shell_output("#{bin}/tccutil check 2>&1")
assert_match "tccutil #{version}", shell_output("#{bin}/tccutil --version")
end
end