fixed deps check

This commit is contained in:
partisan 2025-01-18 20:41:00 +01:00
parent cad3f9a27f
commit 4aaee3d230

View file

@ -13,22 +13,22 @@ import (
func CheckDependencies() error {
// Common dependencies
dependencies := map[string]string{
"git": "https://git-scm.com/download/win", // Git
"python": "https://www.python.org/downloads/", // Python
"pip3": "https://pip.pypa.io/en/stable/installing/", // Pip3
"mercurial": "https://www.mercurial-scm.org/", // Mercurial (hg)
"git": "https://git-scm.com/downloads", // Git
"python": "https://www.python.org/downloads/", // Python
"pip3": "https://pip.pypa.io/en/stable/installing/", // Pip3
"hg": "https://www.mercurial-scm.org/", // Mercurial (hg)
}
// Add platform-specific dependencies
if runtime.GOOS == "windows" || !isMsys2() {
if runtime.GOOS == "windows" {
mozBuildPath := os.Getenv("MOZILLABUILD")
if mozBuildPath == "" {
mozBuildPath = "C:\\mozilla-build" // Default path for MozillaBuild
mozBuildPath = "C:\\mozilla-build" // Default path for MozillaBuild on Windows
}
if !dirExists(mozBuildPath) {
dependencies["mozbuild"] = "https://ftp.mozilla.org/pub/mozilla/libraries/win32/MozillaBuildSetup-Latest.exe"
}
} else if runtime.GOOS != "windows" || !isMsys2() {
} else {
dependencies["rsync"] = "https://rsync.samba.org/download.html" // rsync for non-Windows platforms
}
@ -40,10 +40,10 @@ func CheckDependencies() error {
}
}
// Special check for `mach` in the local source directory
// Check for `mach` script in the source directory
machPath := filepath.Join("mozilla-release", "mach")
if !fileExists(machPath) {
missingTools = append(missingTools, "mach (ensure you are in the mozilla-release directory)")
missingTools = append(missingTools, "mach (ensure you are in the mozilla-release directory and it is built)")
}
// Report missing tools if any
@ -61,8 +61,12 @@ func CheckDependencies() error {
// isCommandAvailable checks if a command/tool is available on the system.
func isCommandAvailable(command string) bool {
_, err := exec.LookPath(command)
return err == nil
path, err := exec.LookPath(command)
if err != nil {
return false
}
fmt.Printf("Command '%s' found at path '%s'\n", command, path)
return true
}
// fileExists checks if a file exists at the given path.