Skip to content

Commit 257d79f

Browse files
committed
Merge branch version/0-35-0-RC1 to adopt changes from PR #2113
2 parents 6030c74 + 2ba8438 commit 257d79f

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

pkg/platform/runtime/setup/implementations/camel/prepare_mac.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build darwin
12
// +build darwin
23

34
package camel
@@ -7,6 +8,7 @@ import (
78
"os"
89
"path/filepath"
910
"regexp"
11+
"strings"
1012

1113
"github.com/ActiveState/cli/internal/constants"
1214
"github.com/ActiveState/cli/internal/errs"
@@ -55,6 +57,9 @@ func (m *MetaData) Prepare(installRoot string) error {
5557
if pythonpath, ok := os.LookupEnv("PYTHONPATH"); ok {
5658
m.PathListEnv["PYTHONPATH"] = pythonpath
5759
} else if fileutils.DirExists(sitePackages) {
60+
if strings.HasPrefix(sitePackages, installRoot) {
61+
sitePackages = strings.Replace(sitePackages, installRoot, "${INSTALLDIR}", 1)
62+
}
5863
m.PathListEnv["PYTHONPATH"] = sitePackages
5964
}
6065

test/integration/activate_int_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,26 @@ func (suite *ActivateIntegrationTestSuite) TestActivate_PythonPath() {
221221
// ensure that shell is functional
222222
cp.WaitForInput()
223223

224+
// Verify that PYTHONPATH is set correctly to the installed site-packages, not a temp runtime
225+
// setup directory.
226+
if runtime.GOOS == "windows" {
227+
cp.Send("echo %PYTHONPATH%")
228+
} else {
229+
cp.Send("echo $PYTHONPATH")
230+
}
231+
suite.Assert().NotContains(cp.TrimmedSnapshot(), constants.LocalRuntimeTempDirectory)
232+
// Verify the temp runtime setup directory has been removed.
233+
runtimeFound := false
234+
entries, err := fileutils.ListDir(ts.Dirs.Cache, true)
235+
suite.Require().NoError(err)
236+
for _, entry := range entries {
237+
if entry.IsDir() && fileutils.DirExists(filepath.Join(entry.Path(), constants.LocalRuntimeEnvironmentDirectory)) {
238+
runtimeFound = true
239+
suite.Assert().NoDirExists(filepath.Join(entry.Path(), constants.LocalRuntimeTempDirectory))
240+
}
241+
}
242+
suite.Assert().True(runtimeFound, "runtime directory was not found in ts.Dirs.Cache")
243+
224244
// test that PYTHONPATH is preserved in environment (https://www.pivotaltracker.com/story/show/178458102)
225245
if runtime.GOOS == "windows" {
226246
cp.Send("set PYTHONPATH=/custom_pythonpath")

0 commit comments

Comments
 (0)