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

[develop] Update to virtualenv module removing pyvenv if Python greater than 3.6 #52279

Merged
14 changes: 11 additions & 3 deletions salt/modules/virtualenv_mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,17 @@ def create(path,
salt '*' virtualenv.create /path/to/new/virtualenv
'''
if venv_bin is None:
venv_bin = __pillar__.get('venv_bin') or __opts__.get('venv_bin')

cmd = [venv_bin]
# Beginning in 3.6, pyvenv has been deprecated
# in favor of "python3 -m venv"
if sys.version_info >= (3, 6):
venv_bin = ['python3', '-m', 'venv']
else:
venv_bin = __pillar__.get('venv_bin') or __opts__.get('venv_bin')

if not isinstance(venv_bin, list):
cmd = [venv_bin]
else:
cmd = venv_bin

if 'pyvenv' not in venv_bin:
# ----- Stop the user if pyvenv only options are used --------------->
Expand Down
4 changes: 0 additions & 4 deletions tests/integration/states/test_pip_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,6 @@ def test_issue_6833_pip_upgrade_pip(self):
try:
try:
self.assertEqual(ret['retcode'], 0)
self.assertIn(
'New python executable',
ret['stdout']
)
except AssertionError:
import pprint
pprint.pprint(ret)
Expand Down