This repository was archived by the owner on Jul 31, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +7
-11
lines changed Expand file tree Collapse file tree 2 files changed +7
-11
lines changed Original file line number Diff line number Diff line change 34
34
default [ 'python' ] [ 'binary' ] = "#{ node [ 'python' ] [ 'prefix_dir' ] } /bin/python"
35
35
36
36
default [ 'python' ] [ 'url' ] = 'http://www.python.org/ftp/python'
37
- default [ 'python' ] [ 'version' ] = '2.7.5 '
37
+ default [ 'python' ] [ 'version' ] = '2.7.7 '
38
38
default [ 'python' ] [ 'checksum' ] = '3b477554864e616a041ee4d7cef9849751770bc7c39adaf78a94ea145c488059'
39
39
default [ 'python' ] [ 'configure_options' ] = %W{ --prefix=#{ python [ 'prefix_dir' ] } }
40
40
default [ 'python' ] [ 'make_options' ] = %W{ install }
Original file line number Diff line number Diff line change @@ -106,17 +106,13 @@ def load_current_resource
106
106
107
107
def current_installed_version
108
108
@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 )
117
114
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 ]
120
116
end
121
117
end
122
118
You can’t perform that action at this time.
0 commit comments