Make IDLE work without python3-test installed
This commit is contained in:
parent
924c3ebdb1
commit
b399bc200e
2 changed files with 125 additions and 1 deletions
111
00393-idle---fix-buggy-macosx-patch.patch
Normal file
111
00393-idle---fix-buggy-macosx-patch.patch
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: "Miss Islington (bot)"
|
||||
<31488909+miss-islington@users.noreply.github.com>
|
||||
Date: Sun, 16 Oct 2022 08:33:33 -0700
|
||||
Subject: [PATCH] 00393: IDLE - fix buggy macosx patch
|
||||
|
||||
GH-97530 fixed IDLE tests possibly crashing on a Mac without a GUI.
|
||||
But it resulted in IDLE not starting in 3.10.8, 3.12.0a1, and
|
||||
Microsoft Python 3.10.2288.0 when test/* is not installed.
|
||||
After this patch, test.* is only imported when testing on Mac.
|
||||
(cherry picked from commit 35fa5d5e7f2b0971b39b2659dc70cb77e34a7dd6)
|
||||
|
||||
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
|
||||
---
|
||||
Lib/idlelib/NEWS.txt | 5 +++
|
||||
Lib/idlelib/macosx.py | 42 ++++++++++++-------
|
||||
...2-10-15-21-20-40.gh-issue-97527.otAHJM.rst | 3 ++
|
||||
3 files changed, 34 insertions(+), 16 deletions(-)
|
||||
create mode 100644 Misc/NEWS.d/next/IDLE/2022-10-15-21-20-40.gh-issue-97527.otAHJM.rst
|
||||
|
||||
diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt
|
||||
index 277fd9429a..521b1f12f9 100644
|
||||
--- a/Lib/idlelib/NEWS.txt
|
||||
+++ b/Lib/idlelib/NEWS.txt
|
||||
@@ -4,6 +4,11 @@ Released 2023-04-03?
|
||||
=========================
|
||||
|
||||
|
||||
+gh-97527: Fix a bug in the previous bugfix that caused IDLE to not
|
||||
+start when run with 3.10.8, 3.12.0a1, and at least Microsoft Python
|
||||
+3.10.2288.0 installed without the Lib/test package. 3.11.0 was never
|
||||
+affected.
|
||||
+
|
||||
gh-65802: Document handling of extensions in Save As dialogs.
|
||||
|
||||
gh-95191: Include prompts when saving Shell (interactive input/output).
|
||||
diff --git a/Lib/idlelib/macosx.py b/Lib/idlelib/macosx.py
|
||||
index 1085d689f6..f53bd58970 100644
|
||||
--- a/Lib/idlelib/macosx.py
|
||||
+++ b/Lib/idlelib/macosx.py
|
||||
@@ -4,7 +4,6 @@
|
||||
from os.path import expanduser
|
||||
import plistlib
|
||||
from sys import platform # Used in _init_tk_type, changed by test.
|
||||
-from test.support import requires, ResourceDenied
|
||||
|
||||
import tkinter
|
||||
|
||||
@@ -16,27 +15,38 @@
|
||||
|
||||
def _init_tk_type():
|
||||
""" Initialize _tk_type for isXyzTk functions.
|
||||
+
|
||||
+ This function is only called once, when _tk_type is still None.
|
||||
"""
|
||||
global _tk_type
|
||||
if platform == 'darwin':
|
||||
- try:
|
||||
- requires('gui')
|
||||
- except ResourceDenied: # Possible when testing.
|
||||
- _tk_type = "cocoa" # Newest and most common.
|
||||
- else:
|
||||
- root = tkinter.Tk()
|
||||
- ws = root.tk.call('tk', 'windowingsystem')
|
||||
- if 'x11' in ws:
|
||||
- _tk_type = "xquartz"
|
||||
- elif 'aqua' not in ws:
|
||||
- _tk_type = "other"
|
||||
- elif 'AppKit' in root.tk.call('winfo', 'server', '.'):
|
||||
+
|
||||
+ # When running IDLE, GUI is present, test/* may not be.
|
||||
+ # When running tests, test/* is present, GUI may not be.
|
||||
+ # If not, guess most common. Does not matter for testing.
|
||||
+ from idlelib.__init__ import testing
|
||||
+ if testing:
|
||||
+ from test.support import requires, ResourceDenied
|
||||
+ try:
|
||||
+ requires('gui')
|
||||
+ except ResourceDenied:
|
||||
_tk_type = "cocoa"
|
||||
- else:
|
||||
- _tk_type = "carbon"
|
||||
- root.destroy()
|
||||
+ return
|
||||
+
|
||||
+ root = tkinter.Tk()
|
||||
+ ws = root.tk.call('tk', 'windowingsystem')
|
||||
+ if 'x11' in ws:
|
||||
+ _tk_type = "xquartz"
|
||||
+ elif 'aqua' not in ws:
|
||||
+ _tk_type = "other"
|
||||
+ elif 'AppKit' in root.tk.call('winfo', 'server', '.'):
|
||||
+ _tk_type = "cocoa"
|
||||
+ else:
|
||||
+ _tk_type = "carbon"
|
||||
+ root.destroy()
|
||||
else:
|
||||
_tk_type = "other"
|
||||
+ return
|
||||
|
||||
def isAquaTk():
|
||||
"""
|
||||
diff --git a/Misc/NEWS.d/next/IDLE/2022-10-15-21-20-40.gh-issue-97527.otAHJM.rst b/Misc/NEWS.d/next/IDLE/2022-10-15-21-20-40.gh-issue-97527.otAHJM.rst
|
||||
new file mode 100644
|
||||
index 0000000000..e7fda89741
|
||||
--- /dev/null
|
||||
+++ b/Misc/NEWS.d/next/IDLE/2022-10-15-21-20-40.gh-issue-97527.otAHJM.rst
|
||||
@@ -0,0 +1,3 @@
|
||||
+Fix a bug in the previous bugfix that caused IDLE to not start when run with
|
||||
+3.10.8, 3.12.0a1, and at least Microsoft Python 3.10.2288.0 installed
|
||||
+without the Lib/test package. 3.11.0 was never affected.
|
||||
|
|
@ -17,7 +17,7 @@ URL: https://www.python.org/
|
|||
#global prerel ...
|
||||
%global upstream_version %{general_version}%{?prerel}
|
||||
Version: %{general_version}%{?prerel:~%{prerel}}
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
License: Python-2.0.1
|
||||
|
||||
|
||||
|
|
@ -342,6 +342,15 @@ Patch371: 00371-revert-bpo-1596321-fix-threading-_shutdown-for-the-main-thread-g
|
|||
# Automerge-Triggered-By: GH:gpshead
|
||||
Patch391: 00391-don-t-use-linux-abstract-sockets-for-multiprocessing.patch
|
||||
|
||||
# 00393 # 353b3ca7b9e0884839cd6dea28c9bafd9f878571
|
||||
# IDLE - fix buggy macosx patch
|
||||
#
|
||||
# GH-97530 fixed IDLE tests possibly crashing on a Mac without a GUI.
|
||||
# But it resulted in IDLE not starting in 3.10.8, 3.12.0a1, and
|
||||
# Microsoft Python 3.10.2288.0 when test/* is not installed.
|
||||
# After this patch, test.* is only imported when testing on Mac.
|
||||
Patch393: 00393-idle---fix-buggy-macosx-patch.patch
|
||||
|
||||
# (New patches go here ^^^)
|
||||
#
|
||||
# When adding new patches to "python" and "python3" in Fedora, EL, etc.,
|
||||
|
|
@ -1599,6 +1608,10 @@ CheckPython optimized
|
|||
# ======================================================
|
||||
|
||||
%changelog
|
||||
* Mon Nov 14 2022 Miro Hrončok <mhroncok@redhat.com> - 3.10.8-3
|
||||
- Make IDLE work without python3-test installed
|
||||
- Fixes rhbz#2142602
|
||||
|
||||
* Wed Nov 09 2022 Lumír Balhar <lbalhar@redhat.com> - 3.10.8-2
|
||||
- Fix CVE-2022-42919
|
||||
Resolves: rhbz#2138709
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue