Skip to contentSkip to conversation

mercurial: fix build with Python built against OpenSSL 4.0

PATCH New Alper Ak 1 participant 1 message Sep 9

lore
Share & tools
lore

Alper Ak

author
#0 lore raw

PATCH 1/1 mercurial: fix build with Python built against OpenSSL 4.0

do_compile fails with:

The ssl module does not advertise support for TLS 1.2.
Please make sure that your Python installation was compiled against an OpenSSL version enabling these features (likely this requires the OpenSSL version to be at least 1.0.1).

OpenSSL 4.0 removed TLSv1_2_method(), so Python reports ssl.HAS_TLSv1_2 as False even though TLS 1.2 still works. setup.py only looks at that flag.

Accept ssl.HAS_TLSv1_3 as well.

---
 ...etup-accept-the-TLS-1.3-flag-as-well.patch | 33 +++++++++++++++++++
 .../mercurial/mercurial_7.2.4.bb              |  4 ++-
 2 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-devtools/mercurial/mercurial/0001-setup-accept-the-TLS-1.3-flag-as-well.patch
meta-oe/recipes-devtools/mercurial/mercurial/0001-setup-accept-the-TLS-1.3-flag-as-well.patch new file +33 -0
new file mode 100644
index 0000000000..42a06f4f23
@@ -0,0 +1,33 @@
+From 46eda44a8f696af27e50a3d6a6f846b604e465d2 Mon Sep 17 00:00:00 2001
+From: Alper Ak <[email protected]>
+Date: Tue, 8 Sep 2026 22:00:10 +0300
+Subject: [PATCH] setup: accept the TLS 1.3 flag as well
+
+OpenSSL 4.0 removed TLSv1_2_method(), so Python reports ssl.HAS_TLSv1_2
+as False even though TLS 1.2 still works. The check only looks at that
+flag and stops the build.
+
+Accept ssl.HAS_TLSv1_3 as well.
+
+Upstream-Status: Pending
+Signed-off-by: Alper Ak <[email protected]>
+---
+ setup.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/setup.py b/setup.py
+index ca70bc0..eaaca5b 100644
+--- a/setup.py
++++ b/setup.py
+@@ -12,9 +12,9 @@ import sys
+ import sysconfig
+ import tempfile
+ 
+-if not ssl.HAS_TLSv1_2:
++if not (ssl.HAS_TLSv1_2 or ssl.HAS_TLSv1_3):
+     error = """
+-The `ssl` module does not advertise support for TLS 1.2.
++The `ssl` module does not advertise support for TLS 1.2 or TLS 1.3.
+ Please make sure that your Python installation was compiled against an OpenSSL
+ version enabling these features (likely this requires the OpenSSL version to
+ be at least 1.0.1).
meta-oe/recipes-devtools/mercurial/mercurial_7.2.4.bb +3 -1
index a517b3aa5e..8d111d1a4d 100644
@@ -9,7 +9,9 @@ RDEPENDS:${PN} = "python3 python3-modules"
 
 inherit python3native python3targetconfig
 
-SRC_URI = "https://www.mercurial-scm.org/release/${BP}.tar.gz"
+SRC_URI = "https://www.mercurial-scm.org/release/${BP}.tar.gz \
+           file://0001-setup-accept-the-TLS-1.3-flag-as-well.patch \
+"
 SRC_URI[sha256sum] = "85839e0f39e6cb893a88932aa36ef661759f3c5c5de4551ad26bd9df53cb71a2"
 
 # Constrain the version to digits-and-dots, otherwise the auto-derived regex
Signature · 1 line
2.43.0