Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jul 31, 2024. It is now read-only.

Commit d7dcca4

Browse files
committed
Merge pull request #1 from poise/master
merge upstream repo
2 parents 574ad93 + 56424ab commit d7dcca4

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

attributes/default.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
default['python']['binary'] = "#{node['python']['prefix_dir']}/bin/python"
3535

3636
default['python']['url'] = 'http://www.python.org/ftp/python'
37-
default['python']['version'] = '2.7.5'
37+
default['python']['version'] = '2.7.7'
3838
default['python']['checksum'] = '3b477554864e616a041ee4d7cef9849751770bc7c39adaf78a94ea145c488059'
3939
default['python']['configure_options'] = %W{--prefix=#{python['prefix_dir']}}
4040
default['python']['make_options'] = %W{install}

providers/pip.rb

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,17 +106,13 @@ def load_current_resource
106106

107107
def current_installed_version
108108
@current_installed_version ||= begin
109-
delimeter = /==/
110-
111-
normalized_package_name = new_resource.package_name.gsub('_', '-')
112-
version_check_cmd = "#{which_pip(new_resource)} freeze | grep -i '^#{normalized_package_name}=='"
113-
# incase you upgrade pip with pip!
114-
if new_resource.package_name.eql?('pip')
115-
delimeter = /\s/
116-
version_check_cmd = "#{which_pip(@new_resource)} --version"
109+
out = nil
110+
package_name = new_resource.package_name.gsub('_', '-')
111+
pattern = Regexp.new("^#{Regexp.escape(package_name)} \\(([^)]+)\\)$", true)
112+
shell_out("#{which_pip(new_resource)} list").stdout.lines.find do |line|
113+
out = pattern.match(line)
117114
end
118-
result = shell_out(version_check_cmd)
119-
(result.exitstatus == 0) ? result.stdout.split(delimeter)[1].strip : nil
115+
out.nil? ? nil : out[1]
120116
end
121117
end
122118

0 commit comments

Comments
 (0)