diff --git a/internal/assets/contents/shells/bashrc_append.sh b/internal/assets/contents/shells/bashrc_append.sh index dab323c79c..c09af1c695 100644 --- a/internal/assets/contents/shells/bashrc_append.sh +++ b/internal/assets/contents/shells/bashrc_append.sh @@ -6,7 +6,4 @@ export {{$K}}="{{$V}}:$PATH" export {{$K}}="{{$V}}" {{- end}} {{- end}} -if [[ ! -z "${{.ActivatedEnv}}" && -f "${{.ActivatedEnv}}/{{.ConfigFile}}" ]]; then - echo "State Tool is operating on project ${{.ActivatedNamespaceEnv}}, located at ${{.ActivatedEnv}}" -fi # {{.Stop}} diff --git a/internal/assets/contents/shells/fishrc_append.fish b/internal/assets/contents/shells/fishrc_append.fish index 5d64abb0c1..0f233db90d 100644 --- a/internal/assets/contents/shells/fishrc_append.fish +++ b/internal/assets/contents/shells/fishrc_append.fish @@ -6,7 +6,4 @@ set -xg {{$K}} "{{$V}}:$PATH" set -xg {{$K}} "{{$V}}" {{- end}} {{- end}} -if test ! -z "${{.ActivatedEnv}}"; test -f "${{.ActivatedEnv}}/{{.ConfigFile}}" - echo "State Tool is operating on project ${{.ActivatedNamespaceEnv}}, located at ${{.ActivatedEnv}}" -end -# {{.Stop}} +# {{.Stop}} \ No newline at end of file diff --git a/internal/assets/contents/shells/tcshrc_append.sh b/internal/assets/contents/shells/tcshrc_append.sh index 9b36097219..a8042870fb 100644 --- a/internal/assets/contents/shells/tcshrc_append.sh +++ b/internal/assets/contents/shells/tcshrc_append.sh @@ -5,7 +5,4 @@ setenv {{$K}} "{{$V}}:$PATH" {{- else}} {{- end}} {{- end}} -if ( "${{.ActivatedEnv}}" != "" && -f "${{.ActivatedEnv}}/{{.ConfigFile}}" ) then - echo "State Tool is operating on project ${{.ActivatedNamespaceEnv}}, located at ${{.ActivatedEnv}}" -endif # {{.Stop}} diff --git a/internal/assets/contents/shells/zshrc_append.sh b/internal/assets/contents/shells/zshrc_append.sh index dab323c79c..c09af1c695 100644 --- a/internal/assets/contents/shells/zshrc_append.sh +++ b/internal/assets/contents/shells/zshrc_append.sh @@ -6,7 +6,4 @@ export {{$K}}="{{$V}}:$PATH" export {{$K}}="{{$V}}" {{- end}} {{- end}} -if [[ ! -z "${{.ActivatedEnv}}" && -f "${{.ActivatedEnv}}/{{.ConfigFile}}" ]]; then - echo "State Tool is operating on project ${{.ActivatedNamespaceEnv}}, located at ${{.ActivatedEnv}}" -fi # {{.Stop}} diff --git a/internal/constants/constants.go b/internal/constants/constants.go index 335c57082e..eafa65e54e 100644 --- a/internal/constants/constants.go +++ b/internal/constants/constants.go @@ -83,9 +83,6 @@ const ActivatedStateEnvVarName = "ACTIVESTATE_ACTIVATED" // ActivatedStateIDEnvVarName is the name of the environment variable that is set when in an activated state, its value will be a unique id identifying a specific instance of an activated state const ActivatedStateIDEnvVarName = "ACTIVESTATE_ACTIVATED_ID" -// ActivatedStateProjectEnvVarName is the name of the environment variable that specifies the activated state's org/project namespace. -const ActivatedStateNamespaceEnvVarName = "ACTIVESTATE_ACTIVATED_NAMESPACE" - // ForwardedStateEnvVarName is the name of the environment variable that is set when in an activated state, its value will be the path of the project const ForwardedStateEnvVarName = "ACTIVESTATE_FORWARDED" diff --git a/internal/runbits/activation/activation.go b/internal/runbits/activation/activation.go index d6d23740d8..865c7a9211 100644 --- a/internal/runbits/activation/activation.go +++ b/internal/runbits/activation/activation.go @@ -39,7 +39,7 @@ func ActivateAndWait( } } - ve, err := venv.GetEnv(false, true, projectDir, proj.Namespace().String()) + ve, err := venv.GetEnv(false, true, projectDir) if err != nil { return locale.WrapError(err, "error_could_not_activate_venv", "Could not retrieve environment information.") } diff --git a/internal/runners/exec/exec.go b/internal/runners/exec/exec.go index 08ce26c6a2..a14db66663 100644 --- a/internal/runners/exec/exec.go +++ b/internal/runners/exec/exec.go @@ -142,7 +142,7 @@ func (s *Exec) Run(params *Params, args ...string) (rerr error) { } venv := virtualenvironment.New(rt) - env, err := venv.GetEnv(true, false, projectDir, projectNamespace) + env, err := venv.GetEnv(true, false, projectDir) if err != nil { return locale.WrapError(err, "err_exec_env", "Could not retrieve environment information for your runtime") } diff --git a/internal/runners/shell/shell.go b/internal/runners/shell/shell.go index 22cf15d058..7ecd8f2a45 100644 --- a/internal/runners/shell/shell.go +++ b/internal/runners/shell/shell.go @@ -1,11 +1,8 @@ package shell import ( - "os" - "github.com/ActiveState/cli/internal/analytics" "github.com/ActiveState/cli/internal/config" - "github.com/ActiveState/cli/internal/constants" "github.com/ActiveState/cli/internal/errs" "github.com/ActiveState/cli/internal/locale" "github.com/ActiveState/cli/internal/logging" @@ -93,9 +90,7 @@ func (u *Shell) Run(params *Params) error { } if process.IsActivated(u.config) { - activatedProjectNamespace := os.Getenv(constants.ActivatedStateNamespaceEnvVarName) - activatedProjectDir := os.Getenv(constants.ActivatedStateEnvVarName) - return locale.NewInputError("err_shell_already_active", "", activatedProjectNamespace, activatedProjectDir) + return locale.NewInputError("err_shell_already_active", "", proj.NamespaceString(), proj.Dir()) } u.out.Notice(locale.Tl("shell_project_statement", "", diff --git a/internal/scriptrun/scriptrun.go b/internal/scriptrun/scriptrun.go index 9894a51c3e..70b90c4e24 100644 --- a/internal/scriptrun/scriptrun.go +++ b/internal/scriptrun/scriptrun.go @@ -85,7 +85,7 @@ func (s *ScriptRun) PrepareVirtualEnv() (rerr error) { venv := virtualenvironment.New(rt) projDir := filepath.Dir(s.project.Source().Path()) - env, err := venv.GetEnv(true, true, projDir, s.project.Namespace().String()) + env, err := venv.GetEnv(true, true, projDir) if err != nil { return errs.Wrap(err, "Could not get venv environment") } @@ -95,7 +95,7 @@ func (s *ScriptRun) PrepareVirtualEnv() (rerr error) { } // search the "clean" path first (PATHS that are set by venv) - env, err = venv.GetEnv(false, true, "", "") + env, err = venv.GetEnv(false, true, "") if err != nil { return errs.Wrap(err, "Could not get venv environment") } diff --git a/internal/subshell/sscommon/rcfile.go b/internal/subshell/sscommon/rcfile.go index bf670d6533..b40d2d7e87 100644 --- a/internal/subshell/sscommon/rcfile.go +++ b/internal/subshell/sscommon/rcfile.go @@ -73,12 +73,9 @@ func WriteRcFile(rcTemplateName string, path string, data RcIdentification, env } rcData := map[string]interface{}{ - "Start": data.Start, - "Stop": data.Stop, - "Env": env, - "ActivatedEnv": constants.ActivatedStateEnvVarName, - "ConfigFile": constants.ConfigFileName, - "ActivatedNamespaceEnv": constants.ActivatedStateNamespaceEnvVarName, + "Start": data.Start, + "Stop": data.Stop, + "Env": env, } if err := CleanRcFile(path, data); err != nil { diff --git a/internal/subshell/sscommon/rcfile_test.go b/internal/subshell/sscommon/rcfile_test.go index 19162f7e7b..bd01eb3833 100644 --- a/internal/subshell/sscommon/rcfile_test.go +++ b/internal/subshell/sscommon/rcfile_test.go @@ -3,7 +3,6 @@ package sscommon import ( "fmt" "reflect" - "runtime" "strings" "testing" @@ -44,25 +43,10 @@ func TestWriteRcFile(t *testing.T) { path string env map[string]string } - - fish := fmt.Sprintf( - `set -xg PATH "foo:$PATH" -if test ! -z "$%s"; test -f "$%s/%s" - echo "State Tool is operating on project $%s, located at $%s" -end`, - constants.ActivatedStateEnvVarName, - constants.ActivatedStateEnvVarName, - constants.ConfigFileName, - constants.ActivatedStateNamespaceEnvVarName, - constants.ActivatedStateEnvVarName) - if runtime.GOOS == "windows" { - fish = strings.ReplaceAll(fish, "\n", "\r\n") - } - tests := []struct { name string args args - want error + want error wantContents string }{ { @@ -75,7 +59,7 @@ end`, }, }, nil, - fakeContents("", fish, ""), + fakeContents("", `set -xg PATH "foo:$PATH"`, ""), }, { "Write RC update", @@ -87,7 +71,7 @@ end`, }, }, nil, - fakeContents(strings.Join([]string{"before", "after"}, fileutils.LineEnd), fish, ""), + fakeContents(strings.Join([]string{"before", "after"}, fileutils.LineEnd), `set -xg PATH "foo:$PATH"`, ""), }, } for _, tt := range tests { diff --git a/internal/virtualenvironment/virtualenvironment.go b/internal/virtualenvironment/virtualenvironment.go index 055bc890fc..e6aca20fe3 100644 --- a/internal/virtualenvironment/virtualenvironment.go +++ b/internal/virtualenvironment/virtualenvironment.go @@ -29,7 +29,7 @@ func New(runtime *runtime.Runtime) *VirtualEnvironment { } // GetEnv returns a map of the cumulative environment variables for all active virtual environments -func (v *VirtualEnvironment) GetEnv(inherit bool, useExecutors bool, projectDir, namespace string) (map[string]string, error) { +func (v *VirtualEnvironment) GetEnv(inherit bool, useExecutors bool, projectDir string) (map[string]string, error) { envMap := make(map[string]string) // Source runtime environment information @@ -44,7 +44,6 @@ func (v *VirtualEnvironment) GetEnv(inherit bool, useExecutors bool, projectDir, if projectDir != "" { envMap[constants.ActivatedStateEnvVarName] = projectDir envMap[constants.ActivatedStateIDEnvVarName] = v.activationID - envMap[constants.ActivatedStateNamespaceEnvVarName] = namespace // Get project from explicitly defined configuration file configFile := filepath.Join(projectDir, constants.ConfigFileName) diff --git a/pkg/platform/runtime/buildexpression/buildexpression.go b/pkg/platform/runtime/buildexpression/buildexpression.go index d759e99819..8b32cc86b4 100644 --- a/pkg/platform/runtime/buildexpression/buildexpression.go +++ b/pkg/platform/runtime/buildexpression/buildexpression.go @@ -592,7 +592,7 @@ func (e *BuildExpression) getSolveNode() (*Ap, error) { continue } - if a.Assignment.Name == "" || a.Assignment.Name != "runtime" { + if a.Assignment.Name == "" { continue } @@ -625,7 +625,7 @@ func recurseLets(let *Let) (*Ap, error) { continue } - if a.Name == "" || a.Name != "runtime" { + if a.Name == "" { continue } diff --git a/test/integration/shell_int_test.go b/test/integration/shell_int_test.go index ea030d5bfe..17e1a6eaa5 100644 --- a/test/integration/shell_int_test.go +++ b/test/integration/shell_int_test.go @@ -267,8 +267,6 @@ func (suite *ShellIntegrationTestSuite) SetupRCFile(ts *e2e.Session) { rcFile, err := subshell.RcFile() suite.Require().NoError(err) - err = fileutils.TouchFileUnlessExists(rcFile) - suite.Require().NoError(err) err = fileutils.CopyFile(rcFile, filepath.Join(ts.Dirs.HomeDir, filepath.Base(rcFile))) suite.Require().NoError(err)