[DRE-commits] [ruby-pygments.rb] 04/04: Add patch to invoke mentos.py directly

Per Andersson avtobiff-guest at moszumanska.debian.org
Fri Apr 4 01:36:26 UTC 2014


This is an automated email from the git hooks/post-receive script.

avtobiff-guest pushed a commit to branch master
in repository ruby-pygments.rb.

commit 82dcc2c424fed3d4448174f796bd135f7eb0f34e
Author: Per Andersson <avtobiff at gmail.com>
Date:   Fri Apr 4 02:21:02 2014 +0200

    Add patch to invoke mentos.py directly
    
    Forwarded upstream https://github.com/tmm1/pygments.rb/pull/119
---
 .../0006-Invoke-mentos-directly-on-GNU-Linux.patch | 46 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 2 files changed, 47 insertions(+)

diff --git a/debian/patches/0006-Invoke-mentos-directly-on-GNU-Linux.patch b/debian/patches/0006-Invoke-mentos-directly-on-GNU-Linux.patch
new file mode 100644
index 0000000..824f4d7
--- /dev/null
+++ b/debian/patches/0006-Invoke-mentos-directly-on-GNU-Linux.patch
@@ -0,0 +1,46 @@
+From cf77a917f7e4d21b03397b39278357c3e9650b72 Mon Sep 17 00:00:00 2001
+From: Per Andersson <avtobiff at gmail.com>
+Date: Wed, 2 Apr 2014 23:30:58 +0200
+Subject: [PATCH] Invoke mentos directly on GNU/Linux
+
+Invoking the script on GNU/Linux by passing it as an argument to
+python(2) makes the process use 100% CPU for about tens of seconds when
+it is supposed to timeout (test_returns_nil_on_timeout reproduces this).
+
+On current Debian Sid python2 exists, so this can be used in mentos.py
+shebang.
+
+Brought back script invocation for windows.
+
+This is forwarded upstream https://github.com/tmm1/pygments.rb/pull/119
+---
+ lib/pygments/mentos.py |  2 +-
+ lib/pygments/popen.rb  | 13 ++-----------
+ 2 files changed, 3 insertions(+), 12 deletions(-)
+
+--- a/lib/pygments/popen.rb
++++ b/lib/pygments/popen.rb
+@@ -37,21 +37,12 @@
+ 
+       # A pipe to the mentos python process. #popen4 gives us
+       # the pid and three IO objects to write and read.
+-      script = "#{python_binary} #{File.expand_path('../mentos.py', __FILE__)}"
++      script = "#{File.expand_path('../mentos.py', __FILE__)}"
++      script = "python " + script if is_windows
+       @pid, @in, @out, @err = popen4(script)
+       @log.info "[#{Time.now.iso8601}] Starting pid #{@pid.to_s} with fd #{@out.to_i.to_s}."
+     end
+ 
+-    # Detect a suitable Python binary to use. We can't just use `python2`
+-    # because apparently some old versions of Debian only have `python` or
+-    # something like that.
+-    def python_binary
+-      @python_binary ||= begin
+-        `which python2`
+-        $?.success? ? "python2" : "python"
+-      end
+-    end
+-
+     # Stop the child process by issuing a kill -9.
+     #
+     # We then call waitpid() with the pid, which waits for that particular
diff --git a/debian/patches/series b/debian/patches/series
index 4978335..fa0a2e7 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@
 0003-Conditional-use-of-lexers-file-path.patch
 0004-Remove-unshipped-custom-lexers.patch
 0005-Use-proper-python-shebang.patch
+0006-Invoke-mentos-directly-on-GNU-Linux.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-pygments.rb.git



More information about the Pkg-ruby-extras-commits mailing list