Artifactory, Pip - move get dependencies map script path from package's init
@@ -18,16 +18,6 @@ import (
"strings"
)
-func init() {
- var err error
- pipDependencyMapScriptPath, err = GetDepTreeScriptPath()
- if err != nil {
- panic("Failed initializing dependency-map script.")
- }
-}
-
-var pipDependencyMapScriptPath string
-
// The extractor responsible to calculate the project dependencies.
type Extractor interface {
// Get all the dependencies for the project.
@@ -48,6 +38,11 @@ func BuildPipDependencyMap(pythonExecPath string) (map[string]pipDependencyPacka
pipeReader, pipeWriter := io.Pipe()
defer pipeReader.Close()
+ pipDependencyMapScriptPath, err := GetDepTreeScriptPath()
+ if err != nil {
+ return nil, errorutils.CheckError(err)
+ }
+
// Execute the python pip-dependency-map script.
pipDependencyMapCmd := &pip.PipCmd{
Executable: pythonExecPath,
