Skip to content

Commit

Permalink
Merge branch 'CHEF-1525'
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsdeleo committed Aug 5, 2010
2 parents f0e60c6 + a3bd28c commit 1ad9a31
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions chef/lib/chef/provider/package/easy_install.rb
Expand Up @@ -19,11 +19,15 @@
require 'chef/provider/package'
require 'chef/mixin/command'
require 'chef/resource/package'
require 'chef/mixin/shell_out'

class Chef
class Provider
class Package
class EasyInstall < Chef::Provider::Package

include Chef::Mixin::ShellOut

def install_check(name)
command = "python -c \"import sys; print sys.path\""
check = false
Expand Down Expand Up @@ -73,16 +77,9 @@ def candidate_version
return @candidate_version if @candidate_version

# do a dry run to get the latest version
command = "#{easy_install_binary_path} -n #{@new_resource.package_name}"
status = popen4(command) do |pid, stdin, stdout, stderr|
dry_run_output = ""
stdout.each do |line|
dry_run_output << line
end
dry_run_output[/(.*)Best match: (.*) (.*)\n/]
@candidate_version = $3
@candidate_version
end
result = shell_out!("#{easy_install_binary_path} -n #{@new_resource.package_name}", :returns=>[0,1])
@candidate_version = result.stdout[/(.*)Best match: (.*) (.*)$/, 3]
@candidate_version
end

def install_package(name, version)
Expand All @@ -104,4 +101,4 @@ def purge_package(name, version)
end
end
end
end
end

0 comments on commit 1ad9a31

Please sign in to comment.