Skip to content

Commit eb350ea

Browse files
committed
Pip installation for multiple python versions
1 parent 8f4b10c commit eb350ea

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

manifests/init.pp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
11

22
class pip {
3-
ensure_packages(['curl'])
4-
5-
$get_pip_url = 'https://raw.githubusercontent.com/pypa/pip/1.5.6/contrib/get-pip.py'
6-
7-
exec { 'install-pip':
8-
command => "curl -L $get_pip_url | python",
9-
path => ['/usr/bin', '/usr/local/bin', '/bin/'],
10-
unless => 'which pip',
11-
require => Package['curl'],
12-
}
3+
ensure_resource('pip::install', ['2.6', '2.7', '3.3', '3.4'])
134
}

manifests/install.pp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
define pip::install (
3+
$python_version = $title,
4+
) {
5+
6+
ensure_packages(['curl'], { allow_virtual => true })
7+
8+
$get_pip_url = 'https://raw.githubusercontent.com/pypa/pip/1.5.6/contrib/get-pip.py'
9+
10+
Exec {
11+
path => ['/usr/bin', '/usr/local/bin', '/bin/'],
12+
require => Package['curl'],
13+
}
14+
15+
exec { "install-pip$python_version":
16+
command => "curl -L $get_pip_url | python$python_version",
17+
unless => "which pip$python_version",
18+
onlyif => "which python$python_version",
19+
}
20+
21+
}

0 commit comments

Comments
 (0)