Skip to content

Commit

Permalink
Fix pipenv Test
Browse files Browse the repository at this point in the history
  • Loading branch information
sarao1310 committed Aug 2, 2023
1 parent dc04292 commit 2172525
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions utils/pythonutils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,23 +256,20 @@ func InstallWithLogParsing(tool PythonTool, commandArgs []string, log utils.Log,
// This regular expression allows matching any input, while the execFunc verifies whether the line contains the phrase "Using cached."
// If it does, we proceed to concatenate subsequent lines until we encounter a "(" symbol, indicating the end of the cache file path.
ExecFunc: func(pattern *gofrogcmd.CmdOutputPattern) (string, error) {
// Check for out of bound results.
if len(pattern.MatchedResults)-1 < 0 {
log.Debug(fmt.Sprintf("Failed extracting package name from line: %s", pattern.Line))
return pattern.Line, nil
}
// If this pattern matched before package-name was found, do not collect this path.
if !expectingPackageFilePath {
log.Debug(fmt.Sprintf("Could not resolve package name for download path: %s , continuing...", packageName))
return pattern.Line, nil
}
if strings.Contains(pattern.MatchedResults[0], "Using cached") {
usingCachedMode = true
}

if usingCachedMode {
// Check for out of bound results.
if len(pattern.MatchedResults)-1 < 0 {
log.Debug(fmt.Sprintf("Failed extracting package name from line: %s", pattern.Line))
return pattern.Line, nil
}

// If this pattern matched before package-name was found, do not collect this path.
if !expectingPackageFilePath {
log.Debug(fmt.Sprintf("Could not resolve package name for download path: %s , continuing...", packageName))
return pattern.Line, nil
}

cache = strings.Join([]string{cache, strings.Join(pattern.MatchedResults, "")}, "")
if strings.Contains(cache, "(") {
cache, _, _ = strings.Cut(cache, "(")
Expand Down

0 comments on commit 2172525

Please sign in to comment.