Created
March 8, 2012 22:59
-
-
Save niallo/2004001 to your computer and use it in GitHub Desktop.
Puppet module to install & set default Python to 2.7 on Ubuntu 10.04 LTS / Lucid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class python27 { | |
Package { ensure => "installed" } | |
$apt-base = "/etc/apt/sources.list.d/fkrull-" | |
Exec { require => Package["python-software-properties"] } | |
exec { "python-repo" : | |
command => "/usr/bin/add-apt-repository ppa:fkrull/deadsnakes", | |
creates => "${apt-base}deadsnakes-lucid.list", | |
} | |
$required-execs = [ "python-repo" ] | |
exec { "python-apt-ready" : | |
command => "/usr/bin/apt-get update", | |
require => Exec[$required-execs], | |
onlyif => "/usr/bin/test ! -x /usr/bin/python2.7" | |
} | |
package { [ "python2.7", "python2.7-dev", "build-essential", "pkg-config", "curl", "libssl-dev" ] : | |
require => Exec["python-apt-ready"] | |
} | |
exec { "make-default-python": | |
command => "/usr/sbin/update-alternatives --install /usr/bin/python python /usr/bin/python2.7 3", | |
require => Package["python2.7"], | |
onlyif => '/usr/bin/test "$(/usr/bin/python -c \'import sys; print sys.version_info[:2]\')" != "(2, 7)"' | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment