Skip to content

Commit 685a5d3

Browse files
authored
Add ability to change the executable_fullpath setting for the gitbash shell plugin (#1938)
* change to use super() method, so the inherited method will use GitBash.name(), via cls.name() to access config settings in rez.shells.Shell.find_executable() Signed-off-by: george.ridal <[email protected]> * Added test to check find_executable config override works correctly Signed-off-by: george.ridal <[email protected]> * removed white space Signed-off-by: george.ridal <[email protected]> --------- Signed-off-by: george.ridal <[email protected]>
1 parent 4e00cfd commit 685a5d3

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/rez/tests/test_shells.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,18 @@ def _make_alias(ex):
641641
out, _ = p.communicate()
642642
self.assertEqual(1, p.returncode)
643643

644+
@per_available_shell()
645+
def test_find_executable_config_override(self, shell):
646+
"""Test the shell plugin returns correct exec override from settings."""
647+
config.override("default_shell", shell)
648+
override_attr = "plugins.shell.{}.executable_fullpath".format(shell)
649+
cls = type(create_shell(shell))
650+
with tempfile.TemporaryDirectory() as td:
651+
exe_path = os.path.join(td, cls.executable_name())
652+
with open(exe_path, 'w'):
653+
config.override(override_attr, exe_path)
654+
assert cls.find_executable(cls.executable_name()) == exe_path
655+
644656

645657
if __name__ == '__main__':
646658
unittest.main()

src/rezplugins/shell/gitbash.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def executable_name(cls):
3737

3838
@classmethod
3939
def find_executable(cls, name, check_syspaths=False):
40-
exepath = Bash.find_executable(name, check_syspaths=check_syspaths)
40+
exepath = super(GitBash, cls).find_executable(name, check_syspaths=check_syspaths)
4141

4242
if exepath and "system32" in exepath.lower():
4343
print_warning(

0 commit comments

Comments
 (0)