This repository was archived by the owner on Oct 2, 2018. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2929 end
3030else
3131 default [ 'python' ] [ 'prefix_dir' ] = '/usr/local'
32+ default [ 'python' ] [ 'install_type' ] = 'install'
3233end
3334
3435default [ 'python' ] [ 'binary' ] = "#{ python [ 'prefix_dir' ] } /bin/python"
Original file line number Diff line number Diff line change 2525
2626if node [ 'python' ] [ 'install_method' ] == 'source'
2727 pip_binary = "#{ node [ 'python' ] [ 'prefix_dir' ] } /bin/pip"
28+ major_minor_version = node [ 'python' ] [ 'version' ] [ /\d \. \d / ]
2829elsif platform_family? ( "rhel" )
2930 pip_binary = "/usr/bin/pip"
3031elsif platform_family? ( "smartos" )
5354 not_if "#{ node [ 'python' ] [ 'binary' ] } -c 'import setuptools'"
5455end
5556
57+ execute "altinstall-setuptools" do
58+ cwd Chef ::Config [ :file_cache_path ]
59+ command <<-EOF
60+ #{ node [ 'python' ] [ 'binary' ] } #{ major_minor_version } ez_setup.py
61+ EOF
62+ not_if "#{ node [ 'python' ] [ 'binary' ] } -2.7 -c 'import setuptools'"
63+ only_if { node [ 'python' ] [ 'install_type' ] == "altinstall" }
64+ end
65+
5666execute "install-pip" do
5767 cwd Chef ::Config [ :file_cache_path ]
5868 command <<-EOF
5969 #{ node [ 'python' ] [ 'binary' ] } get-pip.py
6070 EOF
6171 not_if { ::File . exists? ( pip_binary ) }
6272end
73+
74+ execute "altinstall-pip" do
75+ cwd Chef ::Config [ :file_cache_path ]
76+ command <<-EOF
77+ #{ node [ 'python' ] [ 'binary' ] } #{ major_minor_version } get-pip.py
78+ EOF
79+ not_if { ::File . exists? ( pip_binary ) }
80+ only_if { node [ 'python' ] [ 'install_type' ] == "altinstall" }
81+ end
Original file line number Diff line number Diff line change 3333
3434version = node [ 'python' ] [ 'version' ]
3535install_path = "#{ node [ 'python' ] [ 'prefix_dir' ] } /bin/python#{ version . split ( /(^\d +\. \d +)/ ) [ 1 ] } "
36+ install_type = node [ 'python' ] [ 'install_type' ]
3637
3738remote_file "#{ Chef ::Config [ :file_cache_path ] } /Python-#{ version } .tar.bz2" do
3839 source "#{ node [ 'python' ] [ 'url' ] } /#{ version } /Python-#{ version } .tar.bz2"
4647 code <<-EOF
4748 tar -jxvf Python-#{ version } .tar.bz2
4849 (cd Python-#{ version } && ./configure #{ configure_options } )
49- (cd Python-#{ version } && make && make install )
50+ (cd Python-#{ version } && make && make #{ install_type } )
5051 EOF
5152 environment ( {
5253 "LDFLAGS" => "-L#{ node [ 'python' ] [ 'prefix_dir' ] } -L/usr/lib" ,
You can’t perform that action at this time.
0 commit comments