]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-40477: macOS Python Launcher app fixes for recent macOS releases (GH-30348)
authorNed Deily <nad@python.org>
Mon, 3 Jan 2022 06:19:59 +0000 (01:19 -0500)
committerGitHub <noreply@github.com>
Mon, 3 Jan 2022 06:19:59 +0000 (01:19 -0500)
This change solves two problems encountered by users of the macOS Python Launcher app on recent macOS releases (10.14+):

- The launcher app was no longer able to launch the macOS Terminal.app to run a script.

- Even if Terminal.app was already launched, the launcher app was unable to send an Apple Event to Terminal.app to open and run Python with the desired .py file.

Mac/PythonLauncher/Info.plist.in
Mac/PythonLauncher/doscript.m
Misc/NEWS.d/next/macOS/2022-01-02-21-56-53.bpo-40477.W3nnM6.rst [new file with mode: 0644]

index 70f215d07249bfff861a569ffa665e4ce75b9f60..dec0a2eaf5c5690a896e0b0000b91f8ec00395bd 100644 (file)
@@ -3,7 +3,7 @@
 <plist version="1.0">
 <dict>
        <key>CFBundleDevelopmentRegion</key>
-       <string>English</string>
+       <string>en</string>
        <key>CFBundleDocumentTypes</key>
        <array>
                <dict>
@@ -39,6 +39,8 @@
        </array>
        <key>CFBundleExecutable</key>
        <string>Python Launcher</string>
+       <key>NSHumanReadableCopyright</key>
+       <string>Copyright © 2001-2022 Python Software Foundation</string>
        <key>CFBundleGetInfoString</key>
        <string>%VERSION%, © 2001-2022 Python Software Foundation</string>
        <key>CFBundleIconFile</key>
@@ -61,5 +63,7 @@
        <string>MainMenu</string>
        <key>NSPrincipalClass</key>
        <string>NSApplication</string>
+       <key>NSAppleEventsUsageDescription</key>
+       <string>Python Launcher uses Apple events to launch your Python script in a Terminal window.</string>
 </dict>
 </plist>
index cbb783ba3e893d09b7395ec6c740b407da5afa74..f07326bce46fb8570e4abd49493a6a1d2de0dce8 100644 (file)
@@ -19,7 +19,7 @@ doscript(const char *command)
     AEDesc desc;
     OSStatus err;
 
-    [[NSWorkspace sharedWorkspace] launchApplication:@"/Applications/Utilities/Terminal.app/"];
+    [[NSWorkspace sharedWorkspace] launchApplication:@"Terminal.app"];
 
     // Build event
     err = AEBuildAppleEvent(kAECoreSuite, kAEDoScript,
diff --git a/Misc/NEWS.d/next/macOS/2022-01-02-21-56-53.bpo-40477.W3nnM6.rst b/Misc/NEWS.d/next/macOS/2022-01-02-21-56-53.bpo-40477.W3nnM6.rst
new file mode 100644 (file)
index 0000000..fc953b8
--- /dev/null
@@ -0,0 +1,2 @@
+The Python Launcher app for macOS now properly launches scripts and, if
+necessary, the Terminal app when running on recent macOS releases.