fix: make RPM runtime portable on Tumbleweed
This commit is contained in:
+25
-2
@@ -10,6 +10,29 @@ import argparse
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def add_runtime_packages() -> None:
|
||||
"""Make the package-owned, pure-Python dependencies importable.
|
||||
|
||||
RPM and deb installations deliberately use the target system's Python.
|
||||
Their dependencies are vendored without a copied interpreter so a distro
|
||||
Python minor-version update cannot leave Fenris linked to a removed ABI.
|
||||
The legacy development install keeps its venv fallback.
|
||||
"""
|
||||
runtime_dir = Path("/opt/fenris")
|
||||
vendor_dir = runtime_dir / "vendor"
|
||||
if vendor_dir.is_dir():
|
||||
sys.path.insert(0, str(vendor_dir))
|
||||
return
|
||||
|
||||
site_packages = next((runtime_dir / "lib").glob("python*/site-packages"), None)
|
||||
if site_packages:
|
||||
sys.path.insert(0, str(site_packages))
|
||||
|
||||
|
||||
add_runtime_packages()
|
||||
|
||||
|
||||
def is_root() -> bool:
|
||||
@@ -51,8 +74,8 @@ def cmd_tui(args: argparse.Namespace) -> None:
|
||||
|
||||
def cmd_status(args: argparse.Namespace) -> None:
|
||||
"""Show status."""
|
||||
from fenris.status import print_status
|
||||
print_status()
|
||||
from fenris.status import render_status
|
||||
print(render_status())
|
||||
|
||||
|
||||
def cmd_sample(args: argparse.Namespace) -> None:
|
||||
|
||||
Reference in New Issue
Block a user