voice-mode-install 7.4.0__py3-none-any.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.
- voice_mode_install-7.4.0.dist-info/METADATA +192 -0
- voice_mode_install-7.4.0.dist-info/RECORD +12 -0
- voice_mode_install-7.4.0.dist-info/WHEEL +4 -0
- voice_mode_install-7.4.0.dist-info/entry_points.txt +2 -0
- voicemode_install/__init__.py +8 -0
- voicemode_install/checker.py +200 -0
- voicemode_install/cli.py +478 -0
- voicemode_install/dependencies.yaml +367 -0
- voicemode_install/hardware.py +92 -0
- voicemode_install/installer.py +150 -0
- voicemode_install/logger.py +90 -0
- voicemode_install/system.py +146 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"""System detection and platform utilities."""
|
|
2
|
+
|
|
3
|
+
import platform
|
|
4
|
+
import shutil
|
|
5
|
+
import subprocess
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import Optional
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass
|
|
12
|
+
class PlatformInfo:
|
|
13
|
+
"""Information about the current platform."""
|
|
14
|
+
|
|
15
|
+
os_type: str # darwin, linux, windows
|
|
16
|
+
os_name: str # macOS, Ubuntu, Fedora, etc.
|
|
17
|
+
distribution: str # debian, fedora, darwin, etc. (for yaml lookup)
|
|
18
|
+
architecture: str # arm64, x86_64
|
|
19
|
+
is_wsl: bool = False
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def detect_platform() -> PlatformInfo:
|
|
23
|
+
"""Detect the current platform and return platform information."""
|
|
24
|
+
os_type = platform.system().lower()
|
|
25
|
+
architecture = platform.machine().lower()
|
|
26
|
+
|
|
27
|
+
# Normalize architecture names
|
|
28
|
+
if architecture in ('amd64', 'x86_64', 'x64'):
|
|
29
|
+
architecture = 'x86_64'
|
|
30
|
+
elif architecture in ('aarch64', 'arm64'):
|
|
31
|
+
architecture = 'arm64'
|
|
32
|
+
|
|
33
|
+
# Detect WSL
|
|
34
|
+
is_wsl = False
|
|
35
|
+
if os_type == 'linux':
|
|
36
|
+
try:
|
|
37
|
+
with open('/proc/version', 'r') as f:
|
|
38
|
+
is_wsl = 'microsoft' in f.read().lower() or 'wsl' in f.read().lower()
|
|
39
|
+
except FileNotFoundError:
|
|
40
|
+
pass
|
|
41
|
+
|
|
42
|
+
if os_type == 'darwin':
|
|
43
|
+
return PlatformInfo(
|
|
44
|
+
os_type='darwin',
|
|
45
|
+
os_name='macOS',
|
|
46
|
+
distribution='darwin',
|
|
47
|
+
architecture=architecture,
|
|
48
|
+
is_wsl=False
|
|
49
|
+
)
|
|
50
|
+
elif os_type == 'linux':
|
|
51
|
+
# Detect Linux distribution
|
|
52
|
+
distro_info = _detect_linux_distro()
|
|
53
|
+
return PlatformInfo(
|
|
54
|
+
os_type='linux',
|
|
55
|
+
os_name=distro_info['name'],
|
|
56
|
+
distribution=distro_info['family'],
|
|
57
|
+
architecture=architecture,
|
|
58
|
+
is_wsl=is_wsl
|
|
59
|
+
)
|
|
60
|
+
else:
|
|
61
|
+
raise RuntimeError(f"Unsupported operating system: {os_type}")
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def _detect_linux_distro() -> dict:
|
|
65
|
+
"""Detect Linux distribution and family."""
|
|
66
|
+
# Try /etc/os-release first (most modern distros)
|
|
67
|
+
if Path('/etc/os-release').exists():
|
|
68
|
+
os_release = {}
|
|
69
|
+
with open('/etc/os-release') as f:
|
|
70
|
+
for line in f:
|
|
71
|
+
if '=' in line:
|
|
72
|
+
key, value = line.strip().split('=', 1)
|
|
73
|
+
os_release[key] = value.strip('"')
|
|
74
|
+
|
|
75
|
+
distro_id = os_release.get('ID', '').lower()
|
|
76
|
+
distro_id_like = os_release.get('ID_LIKE', '').lower()
|
|
77
|
+
distro_name = os_release.get('NAME', 'Linux')
|
|
78
|
+
|
|
79
|
+
# Determine family for yaml lookup
|
|
80
|
+
if distro_id in ('ubuntu', 'debian') or 'debian' in distro_id_like or 'ubuntu' in distro_id_like:
|
|
81
|
+
return {'name': distro_name, 'family': 'debian'}
|
|
82
|
+
elif distro_id in ('fedora', 'rhel', 'centos', 'rocky', 'alma') or 'fedora' in distro_id_like or 'rhel' in distro_id_like:
|
|
83
|
+
return {'name': distro_name, 'family': 'fedora'}
|
|
84
|
+
elif distro_id == 'arch' or 'arch' in distro_id_like:
|
|
85
|
+
return {'name': distro_name, 'family': 'arch'}
|
|
86
|
+
elif distro_id == 'alpine':
|
|
87
|
+
return {'name': distro_name, 'family': 'alpine'}
|
|
88
|
+
elif distro_id in ('opensuse', 'suse') or 'suse' in distro_id_like:
|
|
89
|
+
return {'name': distro_name, 'family': 'suse'}
|
|
90
|
+
else:
|
|
91
|
+
# Try to infer from ID_LIKE
|
|
92
|
+
if 'debian' in distro_id_like:
|
|
93
|
+
return {'name': distro_name, 'family': 'debian'}
|
|
94
|
+
elif 'fedora' in distro_id_like or 'rhel' in distro_id_like:
|
|
95
|
+
return {'name': distro_name, 'family': 'fedora'}
|
|
96
|
+
|
|
97
|
+
# Fallback: check for package managers
|
|
98
|
+
if Path('/usr/bin/apt').exists() or Path('/usr/bin/apt-get').exists():
|
|
99
|
+
return {'name': 'Debian-based Linux', 'family': 'debian'}
|
|
100
|
+
elif Path('/usr/bin/dnf').exists() or Path('/usr/bin/yum').exists():
|
|
101
|
+
return {'name': 'Fedora-based Linux', 'family': 'fedora'}
|
|
102
|
+
|
|
103
|
+
raise RuntimeError("Unable to detect Linux distribution")
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def get_package_manager(distribution: str) -> str:
|
|
107
|
+
"""Get the package manager command for the distribution."""
|
|
108
|
+
if distribution == 'darwin':
|
|
109
|
+
return 'brew'
|
|
110
|
+
elif distribution == 'debian':
|
|
111
|
+
return 'apt'
|
|
112
|
+
elif distribution == 'fedora':
|
|
113
|
+
return 'dnf'
|
|
114
|
+
elif distribution == 'arch':
|
|
115
|
+
return 'pacman'
|
|
116
|
+
elif distribution == 'alpine':
|
|
117
|
+
return 'apk'
|
|
118
|
+
elif distribution == 'suse':
|
|
119
|
+
return 'zypper'
|
|
120
|
+
else:
|
|
121
|
+
raise ValueError(f"Unknown distribution: {distribution}")
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def check_command_exists(command: str) -> bool:
|
|
125
|
+
"""Check if a command exists in PATH."""
|
|
126
|
+
return shutil.which(command) is not None
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def check_homebrew_installed() -> bool:
|
|
130
|
+
"""Check if Homebrew is installed (macOS only)."""
|
|
131
|
+
return check_command_exists('brew')
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def get_system_info() -> dict:
|
|
135
|
+
"""Get comprehensive system information for logging."""
|
|
136
|
+
platform_info = detect_platform()
|
|
137
|
+
|
|
138
|
+
return {
|
|
139
|
+
'os_type': platform_info.os_type,
|
|
140
|
+
'os_name': platform_info.os_name,
|
|
141
|
+
'distribution': platform_info.distribution,
|
|
142
|
+
'architecture': platform_info.architecture,
|
|
143
|
+
'is_wsl': platform_info.is_wsl,
|
|
144
|
+
'python_version': platform.python_version(),
|
|
145
|
+
'platform': platform.platform(),
|
|
146
|
+
}
|