|
7 | 7 | Puppet::Type.type(:package).provide :pip,
|
8 | 8 | :parent => ::Puppet::Provider::Package do
|
9 | 9 |
|
10 |
| - desc "Python packages via `pip`." |
| 10 | + desc "Python packages via `pip`. |
11 | 11 |
|
12 |
| - has_feature :installable, :uninstallable, :upgradeable, :versionable |
| 12 | + This provider supports the `install_options` attribute, which allows command-line flags to be passed to pip. |
| 13 | + These options should be specified as a string (e.g. '--flag'), a hash (e.g. {'--flag' => 'value'}), |
| 14 | + or an array where each element is either a string or a hash." |
| 15 | + |
| 16 | + has_feature :installable, :uninstallable, :upgradeable, :versionable, :install_options |
13 | 17 |
|
14 | 18 | # Parse lines of output from `pip freeze`, which are structured as
|
15 | 19 | # _package_==_version_.
|
@@ -71,6 +75,7 @@ def latest
|
71 | 75 | # gives the fully-qualified URL to the repository.
|
72 | 76 | def install
|
73 | 77 | args = %w{install -q}
|
| 78 | + args += install_options if @resource[:install_options] |
74 | 79 | if @resource[:source]
|
75 | 80 | if String === @resource[:ensure]
|
76 | 81 | args << "#{@resource[:source]}@#{@resource[:ensure]}#egg=#{
|
@@ -115,4 +120,8 @@ def lazy_pip(*args)
|
115 | 120 | raise e, 'Could not locate the pip command.', e.backtrace
|
116 | 121 | end
|
117 | 122 | end
|
| 123 | + |
| 124 | + def install_options |
| 125 | + join_options(@resource[:install_options]) |
| 126 | + end |
118 | 127 | end
|
0 commit comments