Skip to content

Commit

Permalink
Allow python::version to contain a point (e.g. python3.7)
Browse files Browse the repository at this point in the history
This worked before voxpupuli#489.

Fixes voxpupuli#508.
  • Loading branch information
baurmatt committed Jan 13, 2020
1 parent a6d6ecb commit defa344
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
11 changes: 6 additions & 5 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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'] ? {
Expand Down
12 changes: 12 additions & 0 deletions spec/classes/python_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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' } }
Expand Down

0 comments on commit defa344

Please sign in to comment.