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 { func CheckDependencies() error {
// Common dependencies // Common dependencies
dependencies := map[string]string{ dependencies := map[string]string{
"git": "https://git-scm.com/download/win", // Git "git": "https://git-scm.com/downloads", // Git
"python": "https://www.python.org/downloads/", // Python "python": "https://www.python.org/downloads/", // Python
"pip3": "https://pip.pypa.io/en/stable/installing/", // Pip3 "pip3": "https://pip.pypa.io/en/stable/installing/", // Pip3
"mercurial": "https://www.mercurial-scm.org/", // Mercurial (hg) "hg": "https://www.mercurial-scm.org/", // Mercurial (hg)
} }
// Add platform-specific dependencies // Add platform-specific dependencies
if runtime.GOOS == "windows" || !isMsys2() { if runtime.GOOS == "windows" {
mozBuildPath := os.Getenv("MOZILLABUILD") mozBuildPath := os.Getenv("MOZILLABUILD")
if mozBuildPath == "" { if mozBuildPath == "" {
mozBuildPath = "C:\\mozilla-build" // Default path for MozillaBuild mozBuildPath = "C:\\mozilla-build" // Default path for MozillaBuild on Windows
} }
if !dirExists(mozBuildPath) { if !dirExists(mozBuildPath) {
dependencies["mozbuild"] = "https://ftp.mozilla.org/pub/mozilla/libraries/win32/MozillaBuildSetup-Latest.exe" 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 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") machPath := filepath.Join("mozilla-release", "mach")
if !fileExists(machPath) { 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 // Report missing tools if any
@ -61,8 +61,12 @@ func CheckDependencies() error {
// isCommandAvailable checks if a command/tool is available on the system. // isCommandAvailable checks if a command/tool is available on the system.
func isCommandAvailable(command string) bool { func isCommandAvailable(command string) bool {
_, err := exec.LookPath(command) path, err := exec.LookPath(command)
return err == nil 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. // fileExists checks if a file exists at the given path.