~ruther/guix-local

dec3b249cdb929dc0e56de75e30a59c66920ec33 — Nicolas Graves 1 year, 1 month ago 27ba360
build-system: pyproject: Handle multiprocessing in the entry point.

Fixes guix/guix#1089.

According to the multiprocessing documentation, the entry point should
be protected by using `if __name__ == '__main__':`, see
https://docs.python.org/3/library/multiprocessing.html#multiprocessing-programming

Note that this is not the standard implementation highlighted in
https://packaging.python.org/en/latest/specifications/entry-points/#use-for-scripts
but it will fix scripts using the standard lib multiprocessing and it
should not harm any other script.

 guix/build/pyproject-build-system (create-entrypoints)
[create-script]: Wrap execution line with `if __name__ == '__main__':`

Change-Id: I450eb380cc4f613468395afd4b4eb52673d2ab1a
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
1 files changed, 2 insertions(+), 1 deletions(-)

M guix/build/pyproject-build-system.scm
M guix/build/pyproject-build-system.scm => guix/build/pyproject-build-system.scm +2 -1
@@ 350,7 350,8 @@ and return write it to PATH/NAME."
# Auto-generated entry point script.
import sys
from ~a import ~a
sys.exit(~a())~%" interpreter module function function)))
if __name__ == '__main__':
    sys.exit(~a())~%" interpreter module function function)))
      (chmod file-path #o755)))

  (let* ((site-dir (site-packages inputs outputs))