--- easy_install.rb 2010-11-23 05:24:57.000000000 +0000 +++ easy_install.rb.orig 2010-11-23 04:53:48.000000000 +0000 @@ -34,18 +34,16 @@ begin # first check to see if we can import it - output = shell_out!("python -c \"import #{name}\"", :returns=>[0,1]).stderr - if output.include? "ImportError" - # then check to see if its on the path - output = shell_out!("python -c \"import sys; print sys.path\"", :returns=>[0,1]).stdout - if output.downcase.include? "#{name.downcase}" - check = true - end - else + output = shell_out!("python -c \"import #{name}\"").stderr + unless output.include? "ImportError" check = true end rescue - # it's probably not installed + # then check to see if its on the path + output = shell_out!("python -c \"import sys; print sys.path\"").stdout + if output.downcase.include? "#{name.downcase}" + check = true + end end check @@ -68,18 +66,8 @@ output = shell_out!("python -c \"import #{@new_resource.package_name}; print #{@new_resource.package_name}.__version__\"").stdout package_version = output.strip rescue - output = shell_out!("python -c \"import sys; print sys.path\"", :returns=>[0,1]).stdout - - output_array = output.gsub(/[\[\]]/,'').split(/\s*,\s*/) - package_path = "" - - output_array.each do |entry| - if entry.downcase.include?(@new_resource.package_name) - package_path = entry - end - end - - package_path[/\S\S(.*)\/(.*)-(.*)-py(.*).egg\S/] + output = shell_out!("python -c \"import #{@new_resource.package_name}; print #{@new_resource.package_name}.__path__\"").stdout + output[/\S\S(.*)\/(.*)-(.*)-py(.*).egg\S/] package_version = $3 end end @@ -123,4 +111,4 @@ end end end -end +end