Skip to content

Commit eabb092

Browse files
authored
Merge pull request #137 from tilde-lab/darwin
Support Apple desktops
2 parents 3ef9bae + 13f2591 commit eabb092

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

yascheduler/remote_machine/adapters.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
check_is_debian_15,
1717
check_is_debian_like,
1818
check_is_linux,
19+
check_is_darwin,
1920
check_is_windows,
2021
check_is_windows7,
2122
check_is_windows8,
@@ -131,6 +132,12 @@ class RemoteMachineAdapter(PRemoteMachineAdapter):
131132
checks=(*debian_adapter.checks, check_is_debian_15),
132133
)
133134

135+
darwin_adapter = evolve(
136+
linux_adapter,
137+
platform="darwin",
138+
checks=(check_is_darwin,),
139+
)
140+
134141
windows_adapter = RemoteMachineAdapter(
135142
platform="windows",
136143
path=MyPureWindowsPath,

yascheduler/remote_machine/checks.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ async def check_is_linux(conn: SSHClientConnection) -> bool:
1818
)
1919

2020

21+
@lru_cache
22+
async def check_is_darwin(conn: SSHClientConnection) -> bool:
23+
"Check for Mac"
24+
proc = await conn.run("uname")
25+
return (
26+
proc.returncode == 0
27+
and proc.stdout is not None
28+
and proc.stdout.strip() == "Darwin"
29+
)
30+
31+
2132
@lru_cache
2233
async def _get_os_release(conn: SSHClientConnection) -> Optional[Tuple[str]]:
2334
"Get os release string on linuxes"

yascheduler/remote_machine/remote_machine.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
debian_adapter,
3232
debian_like_adapter,
3333
linux_adapter,
34+
darwin_adapter,
3435
windows7_adapter,
3536
windows8_adapter,
3637
windows10_adapter,
@@ -61,6 +62,7 @@
6162
debian_adapter,
6263
debian_like_adapter,
6364
linux_adapter,
65+
darwin_adapter,
6466
windows10_adapter,
6567
windows11_adapter,
6668
windows12_adapter,

0 commit comments

Comments
 (0)