Page MenuHomeSoftware Heritage

fix pythonpath.sh script + remove bash warnings
ClosedPublic

Authored by anlambert on Jul 27 2017, 11:14 AM.

Details

Reviewers
zack
Group Reviewers
Reviewers
Summary

fix pythonpath.sh script and remove bash warnings

On Debian Stretch, when sourcing the pythonpath.sh script, the following warnings are displayed and the value of the PYTHONPATH
environment variable is not set. This diff fixes those issues.

$ . pythonpath.sh
bash: local: utilisable seulement dans une fonction
bash: local: utilisable seulement dans une fonction
bash: bin/ls-all-repos: Aucun fichier ou dossier de ce type

Diff Detail

Repository
rDENV Development environment
Branch
fix-pythonpath-script
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 989
Build 1308: arc lint + arc unit

Event Timeline

zack requested changes to this revision.Sep 5 2017, 10:35 AM
zack added a subscriber: zack.

This won't work with zsh, and the pythonpath.sh script should be portable across at least bash and zsh, which are the shells commonly used within the team.
If you still have the problem, I fear you'll need to find a more portable solution than this :/

This revision now requires changes to proceed.Sep 5 2017, 10:35 AM

afaict, an easy fix for this is to just use "unset" at the end of the script on the relevant variables, instead of using "local" when declaring them

Seems the only way to make the script portable is to first detect if we are running bash and handle that special case ($PWD could have been used but it prevents to source the script from any folder).
Also prefer to unset the base_path and tmp_path variable instead of declaring them local to avoid bash warnings.

This revision is now accepted and ready to land.Sep 5 2017, 3:23 PM

@anlambert: can you please abandon this diff in differential?
AFAICT it has already been committed in swh-environment (if not, you can land it :))