perforce-agentic-gateway 2026.1__py3-none-win_amd64.whl
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.
- pag/__init__.py +0 -0
- pag/__main__.py +47 -0
- pag/_find_pag.py +94 -0
- perforce_agentic_gateway-2026.1.data/scripts/pag.exe +0 -0
- perforce_agentic_gateway-2026.1.dist-info/METADATA +6 -0
- perforce_agentic_gateway-2026.1.dist-info/RECORD +8 -0
- perforce_agentic_gateway-2026.1.dist-info/WHEEL +4 -0
- perforce_agentic_gateway-2026.1.dist-info/entry_points.txt +2 -0
pag/__init__.py
ADDED
|
File without changes
|
pag/__main__.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"""Entry point for ``python -m pag`` and the ``pag`` console script.
|
|
2
|
+
|
|
3
|
+
On Unix (``sys.platform != "win32"``), uses ``os.execvp`` to replace
|
|
4
|
+
the Python process with the Go binary entirely — no Python process
|
|
5
|
+
remains resident after the exec.
|
|
6
|
+
|
|
7
|
+
On Windows, ``os.execvp`` is not available in a usable form; instead,
|
|
8
|
+
``subprocess.run()`` launches the binary as a child process. The Python
|
|
9
|
+
wrapper stays resident for the lifetime of PAG. ``KeyboardInterrupt``
|
|
10
|
+
exits with code 2; the child's exit code is forwarded via
|
|
11
|
+
``sys.exit``.
|
|
12
|
+
|
|
13
|
+
Both platforms forward ``sys.argv[1:]`` and inherit stdin/stdout/stderr
|
|
14
|
+
from the parent process.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
import os
|
|
20
|
+
import sys
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def main() -> None:
|
|
24
|
+
"""Locate the ``pag`` binary and transfer control to it."""
|
|
25
|
+
from pag._find_pag import find_pag
|
|
26
|
+
|
|
27
|
+
binary = find_pag()
|
|
28
|
+
|
|
29
|
+
if sys.platform != "win32":
|
|
30
|
+
# Unix: exec replaces this process — no return.
|
|
31
|
+
os.execvp(binary, [binary, *sys.argv[1:]]) # noqa: S606
|
|
32
|
+
else:
|
|
33
|
+
# Windows: run as a child process and forward exit code.
|
|
34
|
+
import subprocess
|
|
35
|
+
|
|
36
|
+
try:
|
|
37
|
+
completed = subprocess.run(
|
|
38
|
+
[binary, *sys.argv[1:]],
|
|
39
|
+
check=False,
|
|
40
|
+
)
|
|
41
|
+
except KeyboardInterrupt:
|
|
42
|
+
sys.exit(2)
|
|
43
|
+
sys.exit(completed.returncode)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
if __name__ == "__main__":
|
|
47
|
+
main()
|
pag/_find_pag.py
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"""Locate the ``pag`` binary installed alongside this Python package.
|
|
2
|
+
|
|
3
|
+
Search order (mirrors ruff's ``_find_ruff.py``):
|
|
4
|
+
|
|
5
|
+
1. The current environment's scripts directory
|
|
6
|
+
(``sysconfig.get_path("scripts")``).
|
|
7
|
+
2. The base prefix scripts directory (handles venvs that share a base
|
|
8
|
+
install).
|
|
9
|
+
3. Paths relative to the package root — handles ``pip install --prefix``
|
|
10
|
+
and ``pip install --target`` layouts where the scripts directory is a
|
|
11
|
+
sibling of the package directory rather than the environment root.
|
|
12
|
+
4. The user scheme scripts directory (``pip install --user``).
|
|
13
|
+
|
|
14
|
+
Returns the absolute path to the binary as a string, or raises
|
|
15
|
+
``FileNotFoundError`` with a helpful message if no candidate is found.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
import os
|
|
21
|
+
import sysconfig
|
|
22
|
+
from pathlib import Path
|
|
23
|
+
|
|
24
|
+
# Python 3.8 / 3.9 do not support ``sysconfig.get_path`` with the
|
|
25
|
+
# ``vars`` parameter for the ``platbase`` variable in all schemes.
|
|
26
|
+
# We guard the user-scheme lookup to avoid AttributeError on older
|
|
27
|
+
# Pythons where the ``posix_user`` scheme key set differs.
|
|
28
|
+
_HAVE_USER_SCHEME = hasattr(sysconfig, "get_default_scheme")
|
|
29
|
+
|
|
30
|
+
_BINARY_NAME = "pag.exe" if os.name == "nt" else "pag"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _script_dir(scheme: str) -> Path | None:
|
|
34
|
+
"""Return the scripts directory for *scheme*, or ``None`` on error."""
|
|
35
|
+
try:
|
|
36
|
+
path = sysconfig.get_path("scripts", scheme)
|
|
37
|
+
except (KeyError, TypeError):
|
|
38
|
+
return None
|
|
39
|
+
if path is None:
|
|
40
|
+
return None
|
|
41
|
+
return Path(path)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def find_pag() -> str:
|
|
45
|
+
"""Return the absolute path to the ``pag`` binary.
|
|
46
|
+
|
|
47
|
+
Raises ``FileNotFoundError`` if no candidate is executable.
|
|
48
|
+
"""
|
|
49
|
+
candidates: list[Path] = []
|
|
50
|
+
|
|
51
|
+
# 1. Current environment scripts directory.
|
|
52
|
+
scripts = sysconfig.get_path("scripts")
|
|
53
|
+
if scripts:
|
|
54
|
+
candidates.append(Path(scripts) / _BINARY_NAME)
|
|
55
|
+
|
|
56
|
+
# 2. Base prefix scripts directory (relevant inside a venv whose
|
|
57
|
+
# base installation has the binary).
|
|
58
|
+
base_scripts = _script_dir("posix_prefix" if os.name != "nt" else "nt")
|
|
59
|
+
if base_scripts:
|
|
60
|
+
candidates.append(base_scripts / _BINARY_NAME)
|
|
61
|
+
|
|
62
|
+
# 3. Relative to the package root — handles ``--prefix`` and
|
|
63
|
+
# ``--target`` installs where scripts land next to the package.
|
|
64
|
+
# This file lives at <pkg_root>/pag/_find_pag.py, so the package
|
|
65
|
+
# root is two levels up.
|
|
66
|
+
pkg_root = Path(__file__).parent.parent.resolve()
|
|
67
|
+
# Typical --target layout: <target>/pag/_find_pag.py → binary at
|
|
68
|
+
# <target>/../bin/pag or <target>/../Scripts/pag.exe (Windows).
|
|
69
|
+
bin_subdir = "Scripts" if os.name == "nt" else "bin"
|
|
70
|
+
candidates.append(pkg_root.parent / bin_subdir / _BINARY_NAME)
|
|
71
|
+
# Also check a ``bin``/``Scripts`` sibling of the package root itself.
|
|
72
|
+
candidates.append(pkg_root / bin_subdir / _BINARY_NAME)
|
|
73
|
+
|
|
74
|
+
# 4. User scheme scripts directory (``pip install --user``).
|
|
75
|
+
if _HAVE_USER_SCHEME:
|
|
76
|
+
user_scheme = "nt_user" if os.name == "nt" else "posix_user"
|
|
77
|
+
user_scripts = _script_dir(user_scheme)
|
|
78
|
+
if user_scripts:
|
|
79
|
+
candidates.append(user_scripts / _BINARY_NAME)
|
|
80
|
+
|
|
81
|
+
for candidate in candidates:
|
|
82
|
+
if candidate.is_file():
|
|
83
|
+
return str(candidate)
|
|
84
|
+
|
|
85
|
+
searched = "\n ".join(str(c) for c in candidates)
|
|
86
|
+
raise FileNotFoundError(
|
|
87
|
+
f"could not find the '{_BINARY_NAME}' binary.\n"
|
|
88
|
+
f"Searched:\n {searched}\n\n"
|
|
89
|
+
"If you installed pag from a wheel, the binary should be in your\n"
|
|
90
|
+
"environment's scripts directory. Try re-installing with:\n"
|
|
91
|
+
" pip install --force-reinstall pag\n"
|
|
92
|
+
"or:\n"
|
|
93
|
+
" uv pip install --reinstall pag"
|
|
94
|
+
)
|
|
Binary file
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
perforce_agentic_gateway-2026.1.data/scripts/pag.exe,sha256=UkrgStwmRmixMhRXcAZRfwR019L1SA90kv-DUixB1bM,44729344
|
|
2
|
+
pag/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
pag/__main__.py,sha256=hjKeEOsy75aAT-S6nTG0t2Wtlor_Vp1cusZdSTivbss,1368
|
|
4
|
+
pag/_find_pag.py,sha256=NCijU9rvFw8N5HlruhPK22vXuacm3Gzd7OhVRzzBn3U,3621
|
|
5
|
+
perforce_agentic_gateway-2026.1.dist-info/METADATA,sha256=uM0RLYFrNE7GRbKv9H_Tp_guGIPY0xBLLz4pCqVLKuU,200
|
|
6
|
+
perforce_agentic_gateway-2026.1.dist-info/WHEEL,sha256=8J5De_l23DYBg1F8WpxUs9kfXkLKwOuMY7-443IsXZ0,94
|
|
7
|
+
perforce_agentic_gateway-2026.1.dist-info/entry_points.txt,sha256=iHalm8e5w3hDikY8JGHkogqnhbZutr1JVlO1JWkZDGw,63
|
|
8
|
+
perforce_agentic_gateway-2026.1.dist-info/RECORD,,
|