summaryrefslogtreecommitdiffstats
path: root/puppet/modules/activepython/manifests/windows.pp
blob: 309e531415a8dbf6bea117198bfc24ae785084da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Downloads the given $version of activepython from activestate.com and installs to the specified $path.
# If a different activepython version is already installed there, it is uninstalled first.
class activepython::windows(
    $version = '2.7.2.5',
    $path = 'C:\Python27'
) {
    $os_bits = $::architecture ? {
        x64 => "win64-x64",
        default => "win32-x86"
    }

    # installer file URL
    $url = "http://downloads.activestate.com/ActivePython/releases/${version}/ActivePython-${version}-${os_bits}.msi"

    # Version without build part
    $version_no_buildpart = regsubst($version, '^(\d+)\.(\d+)\.(\d+).(\d+)$', '\1.\2.\3')

    # Activepython outputs version without build part
    $version_expression = "\\b$version_no_buildpart\\b"

    windows::msi_package { "activepython":
        url => $url,
        version => $version,
        version_expression => $version_expression,
        path => $path,
        binary => "$path\\python.exe"
    }
}