Skip to content

Commit 0c5e66c

Browse files
authored
Merge pull request #627 from zanyou/fix-duplicated-args
Remove duplicate arguments in the pip install command
2 parents c5a7944 + fe1c018 commit 0c5e66c

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

manifests/pip.pp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@
173173
}
174174

175175
$pip_install = "${pip_env} --log ${log}/pip.log install"
176-
$pip_common_args = "${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source}"
176+
$pip_common_args = "${pypi_index} ${proxy_flag} ${install_editable} ${source}"
177177

178178
# Explicit version out of VCS when PIP supported URL is provided
179179
if $source =~ /^'(git\+|hg\+|bzr\+|svn\+)(http|https|ssh|svn|sftp|ftp|lp|git)(:\/\/).+'$/ {
@@ -195,7 +195,7 @@
195195

196196
'present': {
197197
# Whatever version is available.
198-
$command = "${pip_install} ${pip_common_args}"
198+
$command = "${pip_install} ${install_args} ${pip_common_args}"
199199
$unless_command = "${pip_env} list | grep -i -e '${grep_regex}'"
200200
}
201201

@@ -214,7 +214,7 @@
214214
$grep_regex_pkgname_with_dashes = "^${pkgname_with_dashes}=="
215215
$installed_version = join( ["${pip_env} freeze --all", " | grep -i -e ${grep_regex_pkgname_with_dashes} | cut -d= -f3", " | tr -d '[:space:]'",])
216216

217-
$command = "${pip_install} --upgrade ${pip_common_args}"
217+
$command = "${pip_install} --upgrade ${install_args} ${pip_common_args}"
218218
$unless_command = "[ \$(${latest_version}) = \$(${installed_version}) ]"
219219
}
220220

spec/defines/pip_spec.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
context 'adds proxy to install command if proxy set' do
6969
let(:params) { { proxy: 'http://my.proxy:3128' } }
7070

71-
it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install --proxy=http://my.proxy:3128 rpyc') }
71+
it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install --proxy=http://my.proxy:3128 rpyc') }
7272
end
7373
end
7474

@@ -81,7 +81,7 @@
8181
context 'adds index to install command if index set' do
8282
let(:params) { { index: 'http://www.example.com/simple/' } }
8383

84-
it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install --index-url=http://www.example.com/simple/ rpyc') }
84+
it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install --index-url=http://www.example.com/simple/ rpyc') }
8585
end
8686
end
8787

@@ -94,6 +94,14 @@
9494
end
9595
end
9696

97+
describe 'install_args as' do
98+
context 'adds install_args to install command if install_args set' do
99+
let(:params) { { install_args: '--pre' } }
100+
101+
it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install --pre rpyc') }
102+
end
103+
end
104+
97105
describe 'install latest' do
98106
context 'does not use pip search in unless' do
99107
let(:params) { { ensure: 'latest' } }

0 commit comments

Comments
 (0)