Skip to content

Commit

Permalink
Upgrade pip and setuptools on venv creation
Browse files Browse the repository at this point in the history
  • Loading branch information
baurmatt committed Nov 27, 2019
1 parent ead6301 commit 450b39e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion manifests/pyvenv.pp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@
mode => $mode,
}

$pip_cmd = "${python::exec_prefix}${venv_dir}/bin/pip"

exec { "python_virtualenv_${venv_dir}":
command => "${virtualenv_cmd} --clear ${system_pkgs_flag} ${venv_dir}",
command => "${virtualenv_cmd} --clear ${system_pkgs_flag} ${venv_dir} && ${pip_cmd} --log ${venv_dir}/pip.log install --upgrade pip && ${pip_cmd} --log ${venv_dir}/pip.log install --upgrade setuptools",
user => $owner,
creates => "${venv_dir}/bin/activate",
path => $_path,
Expand Down
2 changes: 1 addition & 1 deletion spec/defines/pyvenv_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

context 'with default parameters' do
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') }
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 jessie stretch buster].include?(facts[:lsbdistcodename])
it { is_expected.to contain_package('python3.5-venv').that_comes_before('File[/opt/env]') }
Expand Down

0 comments on commit 450b39e

Please sign in to comment.