Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow chaining of workspaces #24

Merged
merged 5 commits into from
Jun 27, 2024
Merged

Allow chaining of workspaces #24

merged 5 commits into from
Jun 27, 2024

Conversation

fmauch
Copy link
Contributor

@fmauch fmauch commented May 23, 2024

Though it is not recommended to chain workspaces it might be desirable to source a workspace that us not the currently sourced one. With the changes introduced in version 0.5.0 this possibility was removed. This commit re-adds that functionality. The .cur_env file is always read independent of whether the ROB_FOLDERS_ACTIVE_ENV variable is set or not.

Though it is not recommended to chain workspaces it might be desirable to
source a workspace that us not the currently sourced one. With the changes
introduced in version 0.5.0 this possibility was removed.
This commit re-adds that functionality. The .cur_env file is always read
independent of whether the ROB_FOLDERS_ACTIVE_ENV variable is set or not.
@codecov-commenter
Copy link

codecov-commenter commented May 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 53.42%. Comparing base (077fd4d) to head (5d76444).
Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #24      +/-   ##
==========================================
+ Coverage   45.84%   53.42%   +7.58%     
==========================================
  Files          26       27       +1     
  Lines        1444     1458      +14     
==========================================
+ Hits          662      779     +117     
+ Misses        782      679     -103     
Flag Coverage Δ
unittests 53.42% <ø> (+7.58%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Oberacda
Copy link
Contributor

The current PR will cause the workspaces to become active at the same time:
image

@fmauch
Copy link
Contributor Author

fmauch commented Jun 20, 2024

Thank you @Oberacda! With the changes you provided, I think this is good to get merged.


Edit: Thinking about this a bit more:

This way, one could not alter the environment without robot_folders e.g. by manually sourcing a virtualenv or setting an installation path by hand. e.g.

### opening a new shell, current env is being cached away ###
ubuntu@jammy:~$ echo $PATH
/home/ubuntu/.node/bin:/home/ubuntu/.local/bin:/home/ubuntu/.node/bin:/home/ubuntu/.local/bin:/home/ubuntu/.local/bin:/home/ubuntu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/home/ubuntu/.fzf/bin
ubuntu@jammy:~$ source .local/pipx/venvs/sphinx-autobuild/bin/activate
(sphinx-autobuild) ubuntu@jammy:~$ echo $PATH
/home/ubuntu/.local/pipx/venvs/sphinx-autobuild/bin:/home/ubuntu/.node/bin:/home/ubuntu/.local/bin:/home/ubuntu/.node/bin:/home/ubuntu/.local/bin:/home/ubuntu/.local/bin:/home/ubuntu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/home/ubuntu/.fzf/bin
(sphinx-autobuild) ubuntu@jammy:~$ fzirob change_environment test_env 
rob_folders change_environment test_env
Sourcing environment '/home/ubuntu/checkout/test_env'
Sourcing /opt/ros/rolling/setup.bash
Sourced colcon workspace /home/ubuntu/checkout/test_env/colcon_ws
Sourced misc_ws workspace from /home/ubuntu/checkout/test_env/misc_ws
Environment setup for 'test_env' done. You now have a sourced environment.
(test_env) ubuntu@jammy:~$ echo $PATH
/home/ubuntu/checkout/test_env/misc_ws/export/bin:/opt/ros/rolling/bin:/home/ubuntu/.local/bin:/home/ubuntu/.node/bin:/home/ubuntu/.local/bin:/home/ubuntu/.local/bin:/home/ubuntu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/home/ubuntu/.fzf/bin

@Oberacda
Copy link
Contributor

I think when souring the virtual env after robot folders, or within the setup_local.sh file, one can still alter the env.
image

@fmauch
Copy link
Contributor Author

fmauch commented Jun 22, 2024

I think when souring the virtual env after robot folders, or within the setup_local.sh file, one can still alter the env.

That's probably a fair point. I've added some documentation on this in 8eb1526. @Oberacda, do you think that makes things clear?

Copy link
Contributor

@Oberacda Oberacda left a comment

Choose a reason for hiding this comment

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

I think this is helpful, but I would add some info to which state the environment is reset.

docs/usage.rst Outdated Show resolved Hide resolved
@fmauch fmauch merged commit fa741e5 into main Jun 27, 2024
10 checks passed
@fmauch fmauch deleted the fix_chaining branch June 27, 2024 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants