1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
From: Debian Ruby Extras Maintainers
<pkg-ruby-extras-maintainers@lists.alioth.debian.org>
Date: Fri, 29 Sep 2017 22:48:27 +0200
Subject: Conditional-use-of-lexers-file-path
---
lib/pygments/popen.rb | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/pygments/popen.rb b/lib/pygments/popen.rb
index 298842e..3e43138 100644
--- a/lib/pygments/popen.rb
+++ b/lib/pygments/popen.rb
@@ -149,7 +149,10 @@ module Pygments
# 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
|