Ensure Mercurial uses Python >= 3.5 (#33784).

Redmine no longer supports Python 2.7.
Mercurial does not support Python 3.0 to 3.4.

Patch by Go MAEDA (user:maeda).


git-svn-id: https://svn.redmine.org/redmine/trunk@23687 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2025-04-20 02:22:18 +00:00
parent ce94a1d71a
commit 18909613f0

View File

@@ -50,7 +50,10 @@ module Redmine
end
def client_available
client_version_above?([5, 1])
client_version_above?([5, 1]) &&
# Redmine >= 6.1 has dropped support for Python 2.7, and
# Mercurial has never supported Python 3.0 to 3.4
(python_version <=> [3, 5]) >= 0
end
def hgversion
@@ -67,6 +70,23 @@ module Redmine
shellout("#{sq_bin} --version") {|io| io.read}.to_s
end
def python_version
@@python_version ||= begin
debuginstall = hgdebuginstall_from_command_line
if (m = debuginstall.match(/checking Python version \(([\d.]+)\)/))
m[1].scan(%r{\d+})
.collect(&:to_i)
.presence
else
nil
end
end
end
def hgdebuginstall_from_command_line
shellout("#{sq_bin} debuginstall") {|io| io.read}.to_s
end
def template_path
@@template_path ||= template_path_for(client_version)
end