Skip to content

Commit 4b55978

Browse files
authored
Merge pull request #248 from alex-feel/alex-feel-dev
Use PowerShell for Windows dependencies instead of bash
2 parents dfdba91 + 03331aa commit 4b55978

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

scripts/setup_environment.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2802,8 +2802,9 @@ def execute_dependency(dep: str) -> bool:
28022802
parts_with_force = parts[:3] + ['--force'] + parts[3:]
28032803
result = run_command(parts_with_force, capture_output=False)
28042804
else:
2805-
# Use bash for consistent cross-platform behavior
2806-
result = run_bash_command(dep, capture_output=False)
2805+
# Windows dependencies are PowerShell commands (user-provided in YAML)
2806+
# This is different from MCP server config which uses bash for generated commands
2807+
result = run_command(['powershell', '-NoProfile', '-Command', dep], capture_output=False)
28072808
else:
28082809
if parts[0] == 'uv' and len(parts) >= 3 and parts[1] == 'tool' and parts[2] == 'install':
28092810
dep_with_force = dep.replace('uv tool install', 'uv tool install --force')

tests/test_setup_environment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ def test_get_auth_headers_from_env_github(self):
532532
headers = setup_environment.get_auth_headers('https://github.com/repo', None)
533533
assert headers == {'Authorization': 'Bearer gh_token'}
534534

535-
@patch.dict('os.environ', {'REPO_TOKEN': 'generic_token'})
535+
@patch.dict('os.environ', {'REPO_TOKEN': 'generic_token'}, clear=True)
536536
def test_get_auth_headers_from_env_generic(self):
537537
"""Test getting generic token from environment."""
538538
headers = setup_environment.get_auth_headers('https://gitlab.com/repo', None)

tests/test_setup_environment_additional.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,17 +1524,17 @@ class TestInstallDependenciesEdgeCases:
15241524
"""Test dependency installation edge cases."""
15251525

15261526
@patch('platform.system', return_value='Windows')
1527-
@patch('setup_environment.run_bash_command')
1528-
def test_install_dependencies_windows_bash_execution(self, mock_bash, _mock_system):
1529-
"""Test bash execution for unknown commands on Windows."""
1530-
mock_bash.return_value = subprocess.CompletedProcess([], 0, '', '')
1527+
@patch('setup_environment.run_command')
1528+
def test_install_dependencies_windows_powershell_execution(self, mock_run, _mock_system):
1529+
"""Test PowerShell execution for unknown commands on Windows."""
1530+
mock_run.return_value = subprocess.CompletedProcess([], 0, '', '')
15311531

15321532
result = setup_environment.install_dependencies({'windows': ['custom-command install package']})
15331533
assert result is True
15341534

1535-
# Should use bash for command execution
1536-
call_args = mock_bash.call_args[0][0]
1537-
assert 'custom-command install package' in call_args
1535+
# Should use PowerShell with -NoProfile flag for command execution
1536+
call_args = mock_run.call_args[0][0]
1537+
assert call_args == ['powershell', '-NoProfile', '-Command', 'custom-command install package']
15381538

15391539
@patch('platform.system', return_value='Linux')
15401540
@patch('setup_environment.run_command')
@@ -1550,17 +1550,17 @@ def test_install_dependencies_uv_tool_force_linux(self, mock_run, _mock_system):
15501550
assert 'uv tool install --force pytest' in ' '.join(call_args)
15511551

15521552
@patch('platform.system', return_value='Windows')
1553-
@patch('setup_environment.run_bash_command')
1554-
def test_install_dependencies_failure_continues(self, mock_bash, _mock_system):
1553+
@patch('setup_environment.run_command')
1554+
def test_install_dependencies_failure_continues(self, mock_run, _mock_system):
15551555
"""Test that dependency installation continues after failure."""
1556-
mock_bash.side_effect = [
1556+
mock_run.side_effect = [
15571557
subprocess.CompletedProcess([], 1, '', 'Error'), # First fails
15581558
subprocess.CompletedProcess([], 0, '', ''), # Second succeeds
15591559
]
15601560

15611561
result = setup_environment.install_dependencies({'windows': ['failing-dep', 'working-dep']})
15621562
assert result is True
1563-
assert mock_bash.call_count == 2
1563+
assert mock_run.call_count == 2
15641564

15651565

15661566
class TestDeriveBaseURLEdgeCases:

0 commit comments

Comments
 (0)