Skip to content
This repository has been archived by the owner on Jun 18, 2019. It is now read-only.

Commit

Permalink
Put in a special case for Ubuntu 18.04 and Debian 10 with Python 3.
Browse files Browse the repository at this point in the history
Fixes #114.
  • Loading branch information
coderanger committed May 3, 2018
1 parent e7528df commit 861bf06
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
15 changes: 14 additions & 1 deletion lib/poise_python/python_providers/system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,22 @@ def python_binary

def install_python
install_system_packages
if node.platform_family?('debian') && system_package_name == 'python3.6'
# Ubuntu 18.04 and Debian 10 have some weird dependency fuckery going on.
_options = options
package %w{python3.6-venv python3.6-distutils} do
action(:upgrade) if _options['package_upgrade']
end
end
end

def uninstall_python
if node.platform_family?('debian') && system_package_name == 'python3.6'
# Other side of the depdency nonsense.
package %w{python3.6-venv python3.6-distutils} do
action(:purge)
end
end
uninstall_system_packages
end

Expand All @@ -74,7 +87,7 @@ def system_package_candidates(version)
end
# Aliases for 2 and 3.
if version == '3' || version == ''
names.concat(%w{python3.5 python35 python3.4 python34 python3.3 python33 python3.2 python32 python3.1 python31 python3.0 python30 python3})
names.concat(%w{python3.7 python37 python3.6 python36 python3.5 python35 python3.4 python34 python3.3 python33 python3.2 python32 python3.1 python31 python3.0 python30 python3})
end
if version == '2' || version == ''
names.concat(%w{python2.7 python27 python2.6 python26 python2.5 python25})
Expand Down
11 changes: 9 additions & 2 deletions test/spec/python_providers/system_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

context 'with version ""' do
let(:python_version) { '' }
it_behaves_like 'system provider', %w{python3.5 python35 python3.4 python34 python3.3 python33 python3.2 python32 python3.1 python31 python3.0 python30 python3 python2.7 python27 python2.6 python26 python2.5 python25 python}, 'python3.4'
it_behaves_like 'system provider', %w{python3.7 python37 python3.6 python36 python3.5 python35 python3.4 python34 python3.3 python33 python3.2 python32 python3.1 python31 python3.0 python30 python3 python2.7 python27 python2.6 python26 python2.5 python25 python}, 'python3.4'
end # /context with version ""

context 'with version 2' do
Expand All @@ -53,7 +53,7 @@

context 'with version 3' do
let(:python_version) { '3' }
it_behaves_like 'system provider', %w{python3.5 python35 python3.4 python34 python3.3 python33 python3.2 python32 python3.1 python31 python3.0 python30 python3 python}, 'python3.4'
it_behaves_like 'system provider', %w{python3.7 python37 python3.6 python36 python3.5 python35 python3.4 python34 python3.3 python33 python3.2 python32 python3.1 python31 python3.0 python30 python3 python}, 'python3.4'
end # /context with version 3

context 'with version 2.3' do
Expand All @@ -65,6 +65,13 @@
it_behaves_like 'system provider', %w{python2.3 python23 python}, 'python2.3'
end # /context with version 2.3

context 'on Ubuntu 18.04' do
let(:chefspec_options) { {platform: 'ubuntu', version: '18.04'} }
let(:python_version) { '3.6' }

it { is_expected.to install_package(%w{python3.6-venv python3.6-distutils}) }
end # /context on Ubuntu 18.04

context 'on Debian 8' do
before { chefspec_options.update(platform: 'debian', version: '8.9') }
it_behaves_like 'system provider', 'python3.4'
Expand Down

0 comments on commit 861bf06

Please sign in to comment.