Description:0003 Conditional use of lexers file path.patch
Subject:Conditional use of lexers file pathUse upstream file path during build, use shipped file once installed.
From:Per Andersson <avtobiff@gmail.com>
---
 lib/pygments/popen.rb |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/lib/pygments/popen.rb
+++ b/lib/pygments/popen.rb
@@ -131,7 +131,10 @@
     # Returns an array of lexers
     def lexers
       begin
-        lexer_file = File.expand_path('../../../lexers', __FILE__)
+        # use upstream file path during build, use shipped file once installed
+        upstream_file = File.expand_path('../../../lexers', __FILE__)
+        debian_file = '/usr/share/ruby-pygments.rb/lexers'
+        lexer_file = File.exists?(debian_file) ? debian_file : upstream_file
         raw = File.open(lexer_file, "rb").read
         Marshal.load(raw)
       rescue Errno::ENOENT
