github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/runtime/setup/implementations/camel/prepare_lin_win.go (about) 1 //go:build !darwin 2 // +build !darwin 3 4 package camel 5 6 import ( 7 "runtime" 8 9 "github.com/ActiveState/cli/internal/constants" 10 "github.com/ActiveState/cli/internal/locale" 11 "github.com/ActiveState/cli/internal/logging" 12 ) 13 14 // Prepare will assume the LibLocation in cases where the metadata 15 // doesn't contain it and we know what it should be 16 func (m *MetaData) Prepare(installRoot string) error { 17 // BinaryLocations 18 if m.BinaryLocations == nil || len(m.BinaryLocations) == 0 { 19 m.BinaryLocations = []MetaDataBinary{ 20 MetaDataBinary{ 21 Path: "bin", 22 Relative: true, 23 }, 24 } 25 } 26 27 // Python 28 if m.hasBinaryFile(installRoot, constants.ActivePython3Executable) || m.hasBinaryFile(installRoot, constants.ActivePython2Executable) { 29 logging.Debug("Detected Python artifact, ensuring backwards compatibility") 30 31 // RelocationTargetBinaries 32 if m.RelocationTargetBinaries == "" { 33 if runtime.GOOS == "windows" { 34 m.RelocationTargetBinaries = "DLLs" 35 } else { 36 m.RelocationTargetBinaries = "lib" 37 } 38 } 39 // RelocationDir 40 if m.RelocationDir == "" { 41 var err error 42 if m.RelocationDir, err = m.pythonRelocationDir(installRoot); err != nil { 43 return err 44 } 45 } 46 // Env 47 m.setPythonEnv() 48 49 //Perl 50 } else if m.hasBinaryFile(installRoot, constants.ActivePerlExecutable) { 51 logging.Debug("Detected Perl artifact, ensuring backwards compatibility") 52 53 // RelocationDir 54 if m.RelocationDir == "" { 55 var err error 56 if m.RelocationDir, err = m.perlRelocationDir(installRoot); err != nil { 57 return err 58 } 59 } 60 // AffectedEnv 61 if m.AffectedEnv == "" { 62 m.AffectedEnv = "PERL5LIB" 63 } 64 } else { 65 logging.Debug("No language detected for %s", installRoot) 66 } 67 68 if m.RelocationDir == "" { 69 return locale.NewError("installer_err_runtime_missing_meta", "", installRoot) 70 } 71 72 return nil 73 }