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.
- {osascript2-1.2.2/osascript2.egg-info → osascript2-1.2.3}/PKG-INFO +1 -1
- {osascript2-1.2.2 → osascript2-1.2.3}/osascript/__init__.py +1 -1
- {osascript2-1.2.2 → osascript2-1.2.3}/osascript/osascript.py +4 -1
- {osascript2-1.2.2 → osascript2-1.2.3/osascript2.egg-info}/PKG-INFO +1 -1
- {osascript2-1.2.2 → osascript2-1.2.3}/LICENSE +0 -0
- {osascript2-1.2.2 → osascript2-1.2.3}/README.md +0 -0
- {osascript2-1.2.2 → osascript2-1.2.3}/osascript/py.typed +0 -0
- {osascript2-1.2.2 → osascript2-1.2.3}/osascript2.egg-info/SOURCES.txt +0 -0
- {osascript2-1.2.2 → osascript2-1.2.3}/osascript2.egg-info/dependency_links.txt +0 -0
- {osascript2-1.2.2 → osascript2-1.2.3}/osascript2.egg-info/top_level.txt +0 -0
- {osascript2-1.2.2 → osascript2-1.2.3}/pyproject.toml +0 -0
- {osascript2-1.2.2 → osascript2-1.2.3}/setup.cfg +0 -0
|
@@ -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([
|
|
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:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|