Skip to content

Commit

Permalink
remove redundant checks + print extraction path
Browse files Browse the repository at this point in the history
  • Loading branch information
vineelsai26 committed Apr 28, 2024
1 parent 873be7a commit 548edca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/python/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,21 +128,15 @@ func installPython(version string) (string, error) {

// Download file
fmt.Println("Downloading Python from " + fullURLFile)
fileName, err := utils.Download(downloadDir, fullURLFile)
_, err := utils.Download(downloadDir, fullURLFile)
if err != nil {
return "", fmt.Errorf("Python version " + version + " not found in precompiled package repo, please run the following command to compile from source \n ```\n vmn --compile python install " + version + "\n ``` \n NOTE: compiling from source might take a while depending on your system resources.")
}

// Unzip file
fmt.Println("Installing Python version " + version + "...")
if strings.HasSuffix(fileName, ".zip") {
if err := utils.Unzip(downloadedFilePath, utils.GetDestination("v"+version, "python")); err != nil {
return "", err
}
} else if strings.HasSuffix(fileName, ".tar.gz") {
if err := utils.UnGzip(downloadedFilePath, utils.GetDestination("v"+version, "python"), true); err != nil {
return "", err
}
if err := utils.UnGzip(downloadedFilePath, utils.GetDestination("v"+version, "python"), true); err != nil {
return "", err
}

// Delete file
Expand Down
2 changes: 2 additions & 0 deletions src/utils/extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
)

func Unzip(src string, dest string) error {
fmt.Println("Extracting Gzip from " + src + " to " + dest)
r, err := zip.OpenReader(src)
if err != nil {
return err
Expand Down Expand Up @@ -84,6 +85,7 @@ func Unzip(src string, dest string) error {
}

func UnGzip(src string, dest string, directExtract bool) error {
fmt.Println("Extracting Gzip from " + src + " to " + dest)
r, err := os.Open(src)
if err != nil {
return err
Expand Down

0 comments on commit 548edca

Please sign in to comment.