Added pythonsitedir and pythonversion facts.
This commit is contained in:
parent
10ad7adce2
commit
5614b07e69
1 changed files with 21 additions and 0 deletions
21
python/lib/facter/python.rb
Normal file
21
python/lib/facter/python.rb
Normal file
|
@ -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
|
Loading…
Add table
Reference in a new issue