puppet-pip 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/puppet/provider/package/pip.rb +35 -13
- metadata +6 -6
@@ -11,12 +11,6 @@ Puppet::Type.type(:package).provide :pip,
|
|
11
11
|
|
12
12
|
has_feature :installable, :uninstallable, :upgradeable, :versionable
|
13
13
|
|
14
|
-
if pathname = `which pip`.chomp
|
15
|
-
commands :pip => pathname
|
16
|
-
else
|
17
|
-
raise NotImplementedError
|
18
|
-
end
|
19
|
-
|
20
14
|
def self.parse(line)
|
21
15
|
if line.chomp =~ /^([^=]+)==([^=]+)$/
|
22
16
|
{:ensure => $2, :name => $1, :provider => name}
|
@@ -34,6 +28,8 @@ Puppet::Type.type(:package).provide :pip,
|
|
34
28
|
end
|
35
29
|
end
|
36
30
|
packages
|
31
|
+
rescue Puppet::DevError
|
32
|
+
[]
|
37
33
|
end
|
38
34
|
|
39
35
|
def query
|
@@ -44,6 +40,8 @@ Puppet::Type.type(:package).provide :pip,
|
|
44
40
|
end
|
45
41
|
end
|
46
42
|
nil
|
43
|
+
rescue Puppet::DevError
|
44
|
+
nil
|
47
45
|
end
|
48
46
|
|
49
47
|
def latest
|
@@ -54,24 +52,48 @@ Puppet::Type.type(:package).provide :pip,
|
|
54
52
|
end
|
55
53
|
|
56
54
|
def install
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
55
|
+
args = %w{install -q}
|
56
|
+
if @resource[:source]
|
57
|
+
args << "-e"
|
58
|
+
if String === @resource[:ensure]
|
59
|
+
args << "#{@resource[:source]}@#{@resource[:ensure]}#egg=#{
|
60
|
+
@resource[:name]}"
|
61
|
+
else
|
62
|
+
args << "#{@resource[:source]}#egg=#{@resource[:name]}"
|
63
|
+
end
|
62
64
|
else
|
63
|
-
|
65
|
+
case @resource[:ensure]
|
66
|
+
when String
|
67
|
+
args << "#{@resource[:name]}==#{@resource[:ensure]}"
|
68
|
+
when :latest
|
69
|
+
args << "--upgrade" << @resource[:name]
|
70
|
+
else
|
71
|
+
args << @resource[:name]
|
72
|
+
end
|
64
73
|
end
|
74
|
+
lazy_pip *args
|
65
75
|
end
|
66
76
|
|
67
77
|
# Uninstall won't work unless this issue gets fixed.
|
68
78
|
# <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=562544>
|
69
79
|
def uninstall
|
70
|
-
|
80
|
+
lazy_pip "uninstall", "-y", "-q", @resource[:name]
|
71
81
|
end
|
72
82
|
|
73
83
|
def update
|
74
84
|
install
|
75
85
|
end
|
76
86
|
|
87
|
+
private
|
88
|
+
def lazy_pip(*args)
|
89
|
+
pip *args
|
90
|
+
rescue NoMethodError
|
91
|
+
if pathname = `which pip`.chomp
|
92
|
+
self.class.commands :pip => pathname
|
93
|
+
retry
|
94
|
+
else
|
95
|
+
raise e
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
77
99
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-pip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Richard Crowley
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-03-01 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
type: :runtime
|
34
34
|
version_requirements: *id001
|
35
35
|
description: Puppet provider of Python packages via pip.
|
36
|
-
email:
|
36
|
+
email: r@rcrowley.org
|
37
37
|
executables: []
|
38
38
|
|
39
39
|
extensions: []
|
@@ -43,7 +43,7 @@ extra_rdoc_files: []
|
|
43
43
|
files:
|
44
44
|
- lib/puppet/provider/package/pip.rb
|
45
45
|
has_rdoc: true
|
46
|
-
homepage: http://github.com/rcrowley/
|
46
|
+
homepage: http://github.com/rcrowley/puppet-pip
|
47
47
|
licenses: []
|
48
48
|
|
49
49
|
post_install_message:
|