Skip to content

Commit

Permalink
Merge pull request #516 from syseleven/feature/upgrade_pip_setuptools
Browse files Browse the repository at this point in the history
Upgrade pip and setuptools on venv creation
  • Loading branch information
bastelfreak authored Dec 9, 2019
2 parents 6325184 + 450b39e commit cb528c9
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 @@ -16,7 +16,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 cb528c9

Please sign in to comment.