diff options
author | 2008-06-06 00:40:01 +0000 | |
---|---|---|
committer | 2008-06-06 00:40:01 +0000 | |
commit | 98a3f19783b2ff06719261bdfc71b0e709d3ac1c (patch) | |
tree | 5156bf81fdadce34ece4b8852edbf4b33a0aa707 /gentoo-data.rb | |
parent | Change the max length logic to match the old TCL. 400 chars is the limit. (diff) | |
download | rbot-gentoo-98a3f19783b2ff06719261bdfc71b0e709d3ac1c.tar.gz rbot-gentoo-98a3f19783b2ff06719261bdfc71b0e709d3ac1c.tar.bz2 rbot-gentoo-98a3f19783b2ff06719261bdfc71b0e709d3ac1c.zip |
Make python location variable.
Diffstat (limited to 'gentoo-data.rb')
-rw-r--r-- | gentoo-data.rb | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/gentoo-data.rb b/gentoo-data.rb index 04d444c..de76c55 100644 --- a/gentoo-data.rb +++ b/gentoo-data.rb @@ -31,6 +31,9 @@ class GentooPlugin < Plugin Config.register Config::StringValue.new('gentoo.scriptdir', :requires_rescan => true, :desc => "Directory for finding external scripts.") + Config.register Config::StringValue.new('gentoo.python', + :requires_rescan => true, + :desc => "Patch to Python binary") def scriptdir sd = @bot.config['gentoo.scriptdir'] @@ -38,6 +41,12 @@ class GentooPlugin < Plugin sd.sub!('@BOTCLASS@', @bot.botclass) return sd end + + def python + py = @bot.config['gentoo.python'] + py = '/usr/bin/python' unless py + return py + end def response_prefix(m) return "#{m.source.nick}: " if m.replyto =~ /^#/ @@ -48,14 +57,14 @@ class GentooPlugin < Plugin cp = params[:pkg] cp = validate_package(m, cp) return if cp.nil? - f = IO.popen("/usr/bin/python #{scriptdir}/metadata.py '#{cp}'") + f = IO.popen("#{python} #{scriptdir}/metadata.py '#{cp}'") m.reply "#{response_prefix(m)}#{f.readlines}" end def meta_verbose(m, params) cp = params[:pkg] cp = validate_package(m, cp) - f = IO.popen("/usr/bin/python #{scriptdir}/metadata.py '#{cp}'") + f = IO.popen("#{python} #{scriptdir}/metadata.py '#{cp}'") output = f.readlines m.reply "#{response_prefix(m)}#{output}" params[:herd] = output[0].gsub(/^.* Herd: ([^ ]+) .*$/, '\1').strip @@ -66,7 +75,7 @@ class GentooPlugin < Plugin def changelog(m, params) cp = params[:pkg] cp = validate_package(m, cp) - f = IO.popen("/usr/bin/python #{scriptdir}/changelog.py '#{cp}'") + f = IO.popen("#{python} #{scriptdir}/changelog.py '#{cp}'") m.reply "#{response_prefix(m)}#{f.readlines}" end @@ -213,7 +222,7 @@ class GentooPlugin < Plugin cp = params[:pkg] cp = validate_package(m, cp) return if cp.nil? - f = IO.popen("/usr/bin/python #{scriptdir}/earch -c '#{cp}'") + f = IO.popen("#{python} #{scriptdir}/earch -c '#{cp}'") output = f.readlines if output[0] =~ /^!!!/ m.reply "#{response_prefix(m)}Unable to find package #{cp}" |