Skip to content

More robust env.sh | Fix conda activate if in subshell#1653

Merged
abejgonzalez merged 1 commit intomainfrom
fix-env
Nov 7, 2023
Merged

More robust env.sh | Fix conda activate if in subshell#1653
abejgonzalez merged 1 commit intomainfrom
fix-env

Conversation

@abejgonzalez
Copy link
Copy Markdown
Contributor

@abejgonzalez abejgonzalez commented Nov 7, 2023

env.sh is now not appended too. Instead, it replaces its text like how conda init bash replaces text in a comment block. Additionally, fixes the way conda activate is called so that it works on any system that has conda setup properly (whether or not conda is in the PATH as a function or not).

Code adapted from: https://github.com/conda/conda/blob/e69b2353c2f14fbfc9fd3aa448ebc991b28ca136/conda/core/initialize.py and from https://github.com/firesim/firesim/blob/70f5ac37ed74e7411ec5a77e422339b880f79a54/build-setup-nolog.sh#L121

Related PRs / Issues:
Fixes #1651.

Type of change:

  • Bug fix
  • New feature
  • Other enhancement

Impact:

  • RTL change
  • Software change (RISC-V software)
  • Build system change
  • Other

Contributor Checklist:

  • Did you set main as the base branch?
  • Is this PR's title suitable for inclusion in the changelog and have you added a changelog:<topic> label?
  • Did you state the type-of-change/impact?
  • Did you delete any extraneous prints/debugging code?
  • Did you mark the PR with a changelog: label?
  • (If applicable) Did you update the conda .conda-lock.yml file if you updated the conda requirements file?
  • (If applicable) Did you add documentation for the feature?
  • (If applicable) Did you add a test demonstrating the PR?
  • (If applicable) Did you mark the PR as Please Backport?

Copy link
Copy Markdown
Contributor

@jerryz123 jerryz123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but perhaps someone more familiar with Conda should review as well

@abejgonzalez
Copy link
Copy Markdown
Contributor Author

LGTM, but perhaps someone more familiar with Conda should review as well

The extra conda lines were merged into / taken from FireSim so they should already be fairly robust. The replacement stuff should be pretty self-explanatory.

I'll go ahead and merge and we can fix it along the way if things break.

@abejgonzalez abejgonzalez merged commit 8b6adb1 into main Nov 7, 2023
@jerryz123 jerryz123 deleted the fix-env branch January 21, 2024 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Source conda.sh in env.sh | More robust env.sh

2 participants