diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index 269cf69c..17838633 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -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 diff --git a/spec/defines/pyvenv_spec.rb b/spec/defines/pyvenv_spec.rb index 36452839..9e074a56 100644 --- a/spec/defines/pyvenv_spec.rb +++ b/spec/defines/pyvenv_spec.rb @@ -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