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

Fix pyvenv on some operating systems #597

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions manifests/pyvenv.pp
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,17 @@

# Debian splits the venv module into a seperate package
if ( $facts['os']['family'] == 'Debian') {
$python3_venv_package = "python${normalized_python_version}-venv"
ensure_packages($python3_venv_package)
if $facts['os']['distro']['codename'] in ['buster','bionic'] {
$python3_venv_package = "python${$python_version_parts[0]}-venv"
ensure_packages($python3_venv_package)

Package[$python3_venv_package] -> File[$venv_dir]
Package[$python3_venv_package] -> File[$venv_dir]
} else {
$python3_venv_package = "python${normalized_python_version}-venv"
ensure_packages($python3_venv_package)

Package[$python3_venv_package] -> File[$venv_dir]
}
}

# pyvenv is deprecated since 3.6 and will be removed in 3.8
Expand Down
6 changes: 5 additions & 1 deletion spec/defines/pyvenv_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@
it { is_expected.to contain_file('/opt/env') }
it { is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('pyvenv-3.5 --clear /opt/env && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade pip && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade setuptools') }

if %w[xenial bionic cosmic disco stretch buster].include?(facts[:lsbdistcodename])
if %w[xenial cosmic disco stretch].include?(facts[:lsbdistcodename])
it { is_expected.to contain_package('python3.5-venv').that_comes_before('File[/opt/env]') }
end

if %w[bionic buster].include?(facts[:lsbdistcodename])
it { is_expected.to contain_package('python3-venv').that_comes_before('File[/opt/env]') }
end
end

describe 'when ensure' do
Expand Down