diff --git a/manifests/install.pp b/manifests/install.pp index 8b409794..026b94e9 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -7,11 +7,12 @@ class python::install { $python = $python::version ? { - 'system' => 'python', - 'pypy' => 'pypy', - /\A(python)?([0-9]+)/ => "python${2}", - /\Arh-python[0-9]{2}/ => $python::version, - default => "python${python::version}", + 'system' => 'python', + 'pypy' => 'pypy', + /\A(python[23]\.[0-9]+)/ => $1, + /\A(python)?([0-9]+)/ => "python${2}", + /\Arh-python[0-9]{2}/ => $python::version, + default => "python${python::version}", } $pythondev = $facts['os']['family'] ? { diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index d5d3fbeb..ec1120cf 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -21,6 +21,18 @@ # Basic python packages (from pip) it { is_expected.to contain_package('virtualenv') } + describe 'with python::version' do + context 'python3.7' do + let(:params) { { version: 'python3.7' } } + + it { is_expected.to compile.with_all_deps } + it { is_expected.to contain_package('pip').with_name('python3.7-pip') } + it { is_expected.to contain_package('python').with_name('python3.7') } + it { is_expected.to contain_package('python-dev').with_name('python3.7-dev') } + it { is_expected.to contain_package('virtualenv').with_name('virtualenv') } + end + end + describe 'with python::dev' do context 'true' do let(:params) { { dev: 'present' } }