Skip to content

Commit a1cec8b

Browse files
logonoffclaude
andcommitted
fix: handle missing locale.bindtextdomain on macOS
locale.bindtextdomain is a GNU extension unavailable on macOS. Wrap in try/except and add gettext as a runtime dependency on macOS in the Homebrew formula. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent baac515 commit a1cec8b

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

Formula/awakeonlan.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ class Awakeonlan < Formula
1818
depends_on "libadwaita"
1919
depends_on "python@3.13"
2020

21+
on_macos do
22+
depends_on "gettext"
23+
end
24+
2125
def install
2226
system "meson", "setup", "build", *std_meson_args
2327
system "meson", "compile", "-C", "build", "--verbose"

src/awakeonlan.in

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ localedir = '@localedir@'
3131

3232
sys.path.insert(1, pkgdatadir)
3333
signal.signal(signal.SIGINT, signal.SIG_DFL)
34-
locale.bindtextdomain('awakeonlan', localedir)
35-
locale.textdomain('awakeonlan')
34+
try:
35+
locale.bindtextdomain('awakeonlan', localedir)
36+
locale.textdomain('awakeonlan')
37+
except AttributeError:
38+
pass
3639
gettext.install('awakeonlan', localedir)
3740

3841
if __name__ == '__main__':

0 commit comments

Comments
 (0)