diff --git a/python/manifests/init.pp b/python/manifests/init.pp index 0533441..e55cdb3 100644 --- a/python/manifests/init.pp +++ b/python/manifests/init.pp @@ -19,3 +19,23 @@ define python::setup::install() { } } + +# Compile python script into binary form. +# +# === Parameters +# +# $name: +# File name to compile. +# +# === Sample usage +# +# python::compile { "/usr/lib/python2.4/site-packages/dynldap.py": } +# +define python::compile() { + + exec { "python -c \"import py_compile; py_compile.compile('${name}')\"": + path => "/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin", + onlyif => "test '${name}' -nt '${name}c'", + } + +}