-
-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathsetup.py
More file actions
88 lines (69 loc) · 3.23 KB
/
setup.py
File metadata and controls
88 lines (69 loc) · 3.23 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/env python3
"""HiDock Next - minimal setup wrapper (clean).
Side-effect free so PEP 517/518 build hooks (wheel / editable / metadata)
execute without triggering legacy interactive provisioning logic.
Real bootstrap logic now lives in ``hidock_bootstrap``.
Forward usage:
python -m hidock_bootstrap [options]
Legacy flags are preserved only so that ``python setup.py --help`` still shows
expected options for older docs/tests. Behaviour is implemented in
``hidock_bootstrap``.
"""
from __future__ import annotations
import argparse
import sys
_BUILD_TRIGGERS = {
"egg_info",
"dist_info",
"build_wheel",
"bdist_wheel",
"build",
"prepare_metadata_for_build_wheel",
"prepare_metadata_for_build_editable",
"build_editable",
"--name",
"--version",
}
_BUILD_SUBSTRING_TRIGGERS = ["editable_wheel", "--editable"]
def _is_backend_invocation(argv: list[str]) -> bool:
return any(t in argv for t in _BUILD_TRIGGERS) or any(
any(sub in arg for sub in _BUILD_SUBSTRING_TRIGGERS) for arg in argv
)
if _is_backend_invocation(sys.argv): # pragma: no cover
try:
from setuptools import setup # type: ignore
setup()
except Exception as exc: # noqa: BLE001
print(f"[setup.py] Metadata fallback failed: {exc}")
finally:
raise SystemExit(0)
def _arg_parser() -> argparse.ArgumentParser:
p = argparse.ArgumentParser(description="HiDock unified setup (wrapper)")
add = p.add_argument
add("--non-interactive", action="store_true", help="Run without interactive prompts where possible")
add("--migrate", choices=["copy", "rebuild", "skip"], help="Legacy .venv migration strategy")
add("--force-new-env", action="store_true", help="Recreate the tagged virtual environment if present")
add("--mode", choices=["end-user", "developer"], help="Explicit setup mode (skip interactive choice)")
add("--skip-tests", action="store_true", help="Skip running test suites")
add("--skip-web", action="store_true", help="Skip web app dependency installation & tests")
add("--skip-audio", action="store_true", help="Skip audio insights dependency installation & tests")
add("--diagnose-venv", action="store_true", help="Run only virtual environment diagnostics and exit")
add("--auto-install-missing", action="store_true", help="Auto-install missing Linux system deps (Debian/Ubuntu)")
add("--concise", action="store_true", help="Concise output (suppress noisy command output; still logged)")
add("--verbose", action="store_true", help="Verbose output (echo all command output immediately)")
return p
def _delegate(): # pragma: no cover
try:
import hidock_bootstrap as _bootstrap # type: ignore
except Exception:
_arg_parser().parse_args() # ensure --help works
print("hidock_bootstrap not available. Install dev deps or run bootstrap module directly.")
return
_bootstrap.main()
def main(): # pragma: no cover
if any(a in ("-h", "--help") for a in sys.argv[1:]):
_arg_parser().parse_args(["--help"]) # prints help & exits
return
_delegate()
if __name__ == "__main__": # pragma: no cover
main()