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.

mouviciel
  • 66,855
  • 13
  • 106
  • 140

1 Answers1

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.

Ronald Oussoren
  • 2,715
  • 20
  • 29
  • Reading the [accepted answer](http://stackoverflow.com/a/11371197/45249) to the [Can executables made with py2app include other terminal scripts and run them](http://stackoverflow.com/q/11370012/45249) 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. – mouviciel Apr 08 '13 at 08:59
  • 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). – Ronald Oussoren Apr 08 '13 at 09:04