osascript2 1.2.2__tar.gz → 1.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: osascript2
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: A tiny python osascript wrapper
5
5
  License: GPLv3
6
6
  Project-URL: Homepage, https://github.com/zwimer/osascript2
@@ -1,5 +1,5 @@
1
1
  from .osascript import run, run_bytes
2
2
 
3
- __version__ = "1.2.2"
3
+ __version__ = "1.2.3"
4
4
 
5
5
  __all__ = ("__version__", "run", "run_bytes")
@@ -4,14 +4,17 @@ from typing import cast
4
4
  import subprocess
5
5
 
6
6
  __all__ = ("run", "run_bytes")
7
+ OSASCRIPT = Path("/usr/bin/osascript")
7
8
 
8
9
 
9
10
  def _sub_run(path: str | Path, text: bool) -> tuple[int, str, str] | tuple[int, bytes, bytes]:
10
- p = subprocess.run(["osascript", path], text=text, capture_output=True, check=False)
11
+ p = subprocess.run([OSASCRIPT, path], text=text, capture_output=True, check=False)
11
12
  return p.returncode, p.stdout, p.stderr
12
13
 
13
14
 
14
15
  def _run(cmd: str | Path, text: bool) -> tuple[int, str, str] | tuple[int, bytes, bytes]:
16
+ if not OSASCRIPT.exists():
17
+ raise NotImplementedError(f"osascript is only available on macOS versions with {OSASCRIPT}")
15
18
  if isinstance(cmd, Path):
16
19
  return _sub_run(cmd, text)
17
20
  with NamedTemporaryFile("w", delete_on_close=False) as f:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: osascript2
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: A tiny python osascript wrapper
5
5
  License: GPLv3
6
6
  Project-URL: Homepage, https://github.com/zwimer/osascript2
File without changes
File without changes
File without changes
File without changes