Skip to content

Commit 8f4c33f

Browse files
authored
Merge pull request #8311 from jglenn9k/master
(PUP-7526) Adds pip2 provider
2 parents 45c3968 + 1b80f6c commit 8f4c33f

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Puppet package provider for Python's `pip2` package management frontend.
2+
# <http://pip.pypa.io/>
3+
4+
Puppet::Type.type(:package).provide :pip2,
5+
:parent => :pip do
6+
7+
desc "Python packages via `pip2`.
8+
9+
This provider supports the `install_options` attribute, which allows command-line flags to be passed to pip2.
10+
These options should be specified as an array where each element is either a string or a hash."
11+
12+
has_feature :installable, :uninstallable, :upgradeable, :versionable, :install_options, :targetable
13+
14+
def self.cmd
15+
["pip2"]
16+
end
17+
end
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
require 'spec_helper'
2+
3+
describe Puppet::Type.type(:package).provider(:pip2) do
4+
5+
it { is_expected.to be_installable }
6+
it { is_expected.to be_uninstallable }
7+
it { is_expected.to be_upgradeable }
8+
it { is_expected.to be_versionable }
9+
it { is_expected.to be_install_options }
10+
it { is_expected.to be_targetable }
11+
12+
it "should inherit most things from pip provider" do
13+
expect(described_class < Puppet::Type.type(:package).provider(:pip))
14+
end
15+
16+
it "should use pip2 command" do
17+
expect(described_class.cmd).to eq(["pip2"])
18+
end
19+
20+
context 'calculated specificity' do
21+
context 'when is not defaultfor' do
22+
subject { described_class.specificity }
23+
it { is_expected.to eql 1 }
24+
end
25+
26+
context 'when is defaultfor' do
27+
let(:os) { Facter.value(:operatingsystem) }
28+
subject do
29+
described_class.defaultfor(operatingsystem: os)
30+
described_class.specificity
31+
end
32+
it { is_expected.to be > 100 }
33+
end
34+
end
35+
36+
end

0 commit comments

Comments
 (0)