Skip to content

Commit 5eb0bc4

Browse files
authored
resolves #242 fix bogus search for Python executable (#246)
1 parent 4bf2e61 commit 5eb0bc4

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

CHANGELOG.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
This document provides a high-level view of the changes to the {project-name} by release.
66
For a detailed view of what has changed, refer to the {uri-repo}/commits/master[commit history] on GitHub.
77

8+
== Unreleased
9+
10+
* Fix bogus search for Python executable ({uri-repo})/issues/242[#242])
11+
812
== 2.3.0 (2022-01-05) - @slonopotamus
913

1014
* Add `Pygments.pygments_version` method to query underlying Pygments version ({uri-repo}/issues/226[#226])

lib/pygments/popen.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ def python_binary
3939
@python_binary ||= find_python_binary
4040
end
4141

42-
def python_binary=(python_bin)
43-
@python_bin = python_bin
44-
end
42+
attr_writer :python_binary
4543

4644
# Stop the child process by issuing a kill -9.
4745
#
@@ -197,7 +195,11 @@ def popen4(argv)
197195

198196
# Detect a suitable Python binary to use.
199197
def find_python_binary
200-
return %w[py python3 python].first { |py| !which(py).nil? } if Gem.win_platform?
198+
if Gem.win_platform?
199+
return %w[py -3] if which('py')
200+
201+
return [%w[python3 python].find { |py| !which(py).nil? }]
202+
end
201203

202204
# On non-Windows platforms, we simply rely on shebang
203205
[]

0 commit comments

Comments
 (0)