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