-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcheck_deps.ps1
79 lines (65 loc) · 2.35 KB
/
check_deps.ps1
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
# Function to log debug info to console
function print_debug_info {
param([string]$info)
Write-Output "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - $info"
}
# Check for the presence of required commands or utilities
function check_command {
param([string]$cmd, [string]$desc)
if (Get-Command $cmd -ErrorAction SilentlyContinue) {
print_debug_info "$desc found at $((Get-Command $cmd).Source)"
return $true
} else {
print_debug_info "$desc is required but not found. - Not installed"
return $false
}
}
# Check for the presence of Visual Studio folder on hard drives
function check_visual_studio {
$vs_installed = $false
$driveLetters = "C", "D", "E"
$vs_folder_name = "Microsoft Visual Studio"
foreach ($drive in $driveLetters) {
$vs_path = "${drive}:\Program Files (x86)\$vs_folder_name"
if (Test-Path $vs_path) {
$vs_installed = $true
print_debug_info "Visual Studio found at $vs_path"
break
}
}
if (-not $vs_installed) {
print_debug_info "Visual Studio is required but not found. - Not installed"
}
return $vs_installed
}
# Check for the presence of Python3 folder on hard drives
function check_python3 {
$python3_installed = $false
$driveLetters = "C", "D", "E"
$python3_folder_name = "Python3"
foreach ($drive in $driveLetters) {
$python3_path = "${drive}:\Program Files (x86)\$python3_folder_name"
if (Test-Path $python3_path) {
$python3_installed = $true
print_debug_info "Python3 found at $python3_path"
break
}
}
if (-not $python3_installed) {
print_debug_info "Python3 is required but not found. - Not installed"
}
return $python3_installed
}
Write-Output "Checking your system..."
# Check for the presence of essential commands
$python_command_found = check_command "python" "Python 3"
# Check for the presence of Visual Studio folder
$vs_found = check_visual_studio
# Check for the presence of Python3 folder
$python3_found = check_python3
# Final output based on checks
if ($python_command_found -and $vs_found -and $python3_found) {
Write-Output "Checking complete. You can now compile DEV7 Tools."
} else {
Write-Output "Some requirements are missing. Please install the missing components to work properly."
}