0

I have a python script that I want to package as a Mac application bundle with py2app. That script calls a CLI executable.

How do I embed that executable in the application bundle?

I tried to edit setup.py in order to include it as a Resource but in that case, execution privileges are lost. Moreover the strip stage of py2app raises an error. I wonder if there is a specific setup.py option that could copy the executable in Content/MacOS instead of Content/Resources.

1 Answer 1

1

Adding the CLI executable to the resources it the correct way to do it, but that doesn't work due to a bug in py2app (the file permissions aren't copied at the moment).

The easiest workaround is to reset the file permissions after calling py2app.

Sign up to request clarification or add additional context in comments.

2 Comments

Reading the accepted answer to the Can executables made with py2app include other terminal scripts and run them question, I understand that it looks more like a feature than like a bug. I try to avoid that solution unless nothing more appropriate exists. Thanks for your answer anyway.
This really is a bug, and it will be fixed in the next py2app release (hopefully later this week). There is placeholder code in the current py2app release where the file permissions should be copied, but that code wasn't actually implemented yet (mostly because py2app can copy files from zipped-up python installations, and getting the right permissions from that is harder than just calling os.stat).

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.