diff --git a/python/lib/facter/python.rb b/python/lib/facter/python.rb new file mode 100644 index 0000000..f4f4cd9 --- /dev/null +++ b/python/lib/facter/python.rb @@ -0,0 +1,21 @@ +Facter.add('pythonsitedir') do + setcode do + if File.exists?('/usr/local/bin/python') + pythonbin='/usr/local/bin/python' + else + pythonbin='python' + end + Facter::Util::Resolution.exec("#{pythonbin} -c 'from distutils.sysconfig import get_python_lib; print get_python_lib()'") + end +end + +Facter.add('pythonversion') do + setcode do + if File.exists?('/usr/local/bin/python') + pythonbin='/usr/local/bin/python' + else + pythonbin='python' + end + Facter::Util::Resolution.exec("#{pythonbin} -c 'import platform; print platform.python_version()'") + end +end