Repository navigation
Expand file tree
/
Copy pathsetup.py
More file actions
51 lines (36 loc) · 1.77 KB
/
Copy pathsetup.py
File metadata and controls
51 lines (36 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
"""Build-time hook for GEAK — all metadata + deps live in pyproject.toml.
The only reason setup.py still exists: a PEP 621 [project] table can't express a
build-time hook, and GEAK needs one so that
pip install git+https://github.com/AMD-AGI/GEAK
runs a best-effort bootstrap during the wheel build (clone the full repo to
$GEAK_HOME + install the Claude Code CLI). The logic lives in geak/bootstrap.py.
The hook fires only on a real wheel build; if pip serves a cached wheel it is
skipped, so force a rebuild with `pip install --no-cache-dir --force-reinstall`
if the clone / Claude Code steps did not run.
Set GEAK_SKIP_BOOTSTRAP=1 to build/install the package without side effects
(CI, docker image builds, or using geak purely as a library dependency).
"""
import os
import sys
from setuptools import setup
from setuptools.command.build_py import build_py
HERE = os.path.abspath(os.path.dirname(__file__))
def run_bootstrap():
# Best-effort: never fail the install because a network step hiccupped.
if os.environ.get("GEAK_SKIP_BOOTSTRAP"):
return
try:
sys.path.insert(0, HERE)
from geak.bootstrap import main as bootstrap_main
bootstrap_main()
except Exception as exc:
sys.stderr.write("[geak-bootstrap WARN] bootstrap step failed: %r\n" % (exc,))
sys.stderr.write("[geak-bootstrap WARN] see the install docs for manual setup: "
"https://github.com/AMD-AGI/GEAK#install\n")
class BuildPyWithBootstrap(build_py):
"""Runs at wheel-build time — which for `pip install git+...` is the user's
machine — so the clone + Claude Code install happen during `pip install`."""
def run(self):
super().run()
run_bootstrap()
setup(cmdclass={"build_py": BuildPyWithBootstrap})