Files
docker-migrate/migrate

55 lines
1.2 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
migrate — Docker Service Migration Tool
Bootstrap: проверяет Python3 и запускает core/main.py
"""
import os
import sys
import subprocess
import shutil
import json
import textwrap
REQUIRED_PYTHON = (3, 8)
def check_python():
if sys.version_info < REQUIRED_PYTHON:
print("[FATAL] Нужен Python >= 3.8")
sys.exit(1)
def find_project_root():
script_dir = os.path.dirname(os.path.abspath(__file__))
possible = [script_dir, os.path.join(script_dir, "docker-migrate")]
for p in possible:
core = os.path.join(p, "core", "main.py")
if os.path.isfile(core):
return p
return None
def main():
check_python()
root = find_project_root()
if not root:
print("[FATAL] Не найдена папка проекта (core/main.py)")
sys.exit(1)
core_path = os.path.join(root)
sys.path.insert(0, core_path)
try:
from core.main import main as core_main
except ImportError as e:
print(f"[FATAL] Не удалось загрузить ядро: {e}")
sys.exit(1)
core_main()
if __name__ == "__main__":
main()