From 67499ed19b96dc26f1792c18730f2b97cd2a3f72 Mon Sep 17 00:00:00 2001 From: Matthias Baur Date: Thu, 5 Dec 2019 15:28:05 +0100 Subject: [PATCH] Allow python::version to contain a point (e.g. python3.7) This worked before #489. Fixes #508. --- manifests/install.pp | 11 ++++++----- spec/classes/python_spec.rb | 12 ++++++++++++ 2 files changed, 18 insertions(+), 5 deletions(-) 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' } }