Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix start up code to also call freeze_support() on macOS when frozen so native macOS executables work #3250

Closed
ichard26 opened this issue Aug 31, 2022 · 0 comments · Fixed by #3275
Labels
C: packaging Installation and packaging of Black T: bug Something isn't working

Comments

@ichard26
Copy link
Collaborator

ichard26 commented Aug 31, 2022

I broke the native macOS executables. The build for 22.8.0 failed since the executable failed the basic sanity checks pre-upload

Usage: black_macos [OPTIONS] SRC ...
Try 'black_macos -h' for help.

Error: No such option: --multiprocessing-fork
Usage: black_macos [OPTIONS] SRC ...
Try 'black_macos -h' for help.

Usage: black_macos [OPTIONS] SRC ...
Try 'black_macos -h' for help.

Error: No such option: --multiprocessing-fork
Error: No such option: --multiprocessing-fork
error: cannot format src/black/__main__.py: A process in the process pool was terminated abruptly while the future was running or pending.
error: cannot format src/black/files.py: A process in the process pool was terminated abruptly while the future was running or pending.

When I first submitted #3211 I checked how the stdlib guards the freeze_support() call and copied it:

So as far as I understand from reading the code, macOS should not need freeze_support() to work with PyInstaller, but apparently it does. Anyway let's fix this by including macOS in the OS check I guess.

black/src/black/__init__.py

Lines 1377 to 1384 in 2018e66

def patched_main() -> None:
if sys.platform == "win32" and getattr(sys, "frozen", False):
from multiprocessing import freeze_support
freeze_support()
patch_click()
main()

@ichard26 ichard26 added T: bug Something isn't working C: packaging Installation and packaging of Black labels Aug 31, 2022
@ichard26 ichard26 added this to the Release 22.9.0 milestone Aug 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: packaging Installation and packaging of Black T: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant