Re: Building python-based Mac app with py2app, creating an installer, generates failing installer

[email protected] Tue, 2 Jan 2018 12:43:52 -0500
Newsgroups gmane.comp.python.apple
Message-ID <[email protected]>
Thanks for your replies. I managed to come up with something that worked!

I had to do a couple of things, for those that are interested…

I needed to upgrade py2app to version 0.8, which fixed a problem in the version we were using (0.7.3) where file permissions were not preserved when copying files into the application bundle. As an aside, I tried the most recent version (0.14), but it created a new and different problem (which I can’t recall at the moment).
In the pkgbuild command, I had been using —root instead of —component when creating the component package from the application. Using —root made a package that expected to install its own python, which is why it was trying to mess with the /System Python.Framework directory. Using —component made things work. :)

Hope may this will help someone someday.

-EricF

> On Dec 23, 2017, at 10:38 AM, Sean Wayland <[email protected]> wrote:
> 
> The other thing I remember is that tkinter is incompatible with py2app.. 
> 
> On Dec 23, 2017 10:21 AM, "Sean Wayland" <[email protected] <mailto:[email protected]>> wrote:
> I tried this once. My vague memory of it is that py2app only works with one version of Python. Did you try using Python 3 instead? You might be able to use JUCE to create a standalone application instead of py2app
> 
> On Dec 22, 2017 4:52 PM, <[email protected] <mailto:[email protected]>> wrote:
> I hope someone on this list can help… I haven’t been able to find many answers on the web.
> 
> Environment: Mac OS 10.8 & 10.11, Python 2.7.6, py2app 0.14
> 
> I create a Mac application bundle from python, using `py2app`, on Mac OS 10.8. This seems to work fine. I then build an installer package using `pkgbuild` and `productbuild`. That appears to build with no errors, until I try to use the installer to install the package.
> 
> I'm running the installer on MacOS 10.11 (it will also have to run on MacOS 10.8-10.13). The installation fails, with the following in the install.log:
> 
> Dec 21 15:14:46 Erics-10-11-Mac-VM shove[30757]: [src=nonrestricted] /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pyconfig.h: unable to remove flag 0x80000 (error 1)
> Dec 21 15:14:46 Erics-10-11-Mac-VM shove[30757]: [source=file] failed _RelinkFile(/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/C/PKInstallSandboxManager/3BE46873-2E16-4787-81A4-335FB1DCB67B.activeSandbox/Root/Applications/MyApp.app/Contents/Resources/include/python2.7/pyconfig.h, /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pyconfig.h): Operation not permitted
> Dec 21 15:14:46 Erics-10-11-Mac-VM shove[30757]: srcPath = /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/C/PKInstallSandboxManager/3BE46873-2E16-4787-81A4-335FB1DCB67B.activeSandbox/Root/Applications/MyApp.app/Contents/Resources/include/python2.7/pyconfig.h NSFileOwnerAccountID=0 NSFileHFSTypeCode=0 NSFileSystemFileNumber=1025119 NSFileExtensionHidden=0 NSFileSystemNumber=16777219 NSFileSize=36515 NSFileGroupOwnerAccountID=0 NSFileOwnerAccountName=root NSFileCreationDate=2017-12-21 20:12:33 +0000 NSFilePosixPermissions=420 NSFileHFSCreatorCode=0 NSFileType=NSFileTypeRegular NSFileGroupOwnerAccountName=wheel NSFileReferenceCount=1 NSFileModificationDate=2017-12-21 20:12:33 +0000
> 
> The issue seems to be that the installer wants to copy (or do something with) `Contents/Resources/include/pyconfig.h` into `/System/Library/Frameworks/Python.framework...` but that operation is not permitted. It's presumably not permitted due to the MacOS System Integrity Protection on `/System/`.
> 
> This raises a couple of questions:
> 
>  1. What exactly is the installer trying to do by copying `pyconfig.h` into a System directory (which is expressly prohibited?) Besides, there's already a `pyconfig.h` there.
>  3. What can I do to fix this? Somehow tell `py2app` not to put `pyconfig.h` in the `include` folder? Tell the installer to not copy it into the `System` folder? Is there a workaround? Disabling `SIP` is not an option.
> 
> Note that I'm constrained to build on MacOS 10.8, and install on arbitrary systems from MacOS 10.8 - 10.3.
> 
> Thanks for your help!
> 
> -EricF
> 
> _______________________________________________
> Pythonmac-SIG maillist  -  [email protected] <mailto:[email protected]>
> https://mail.python.org/mailman/listinfo/pythonmac-sig <https://mail.python.org/mailman/listinfo/pythonmac-sig>
> unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG <https://mail.python.org/mailman/options/Pythonmac-SIG>
>

_______________________________________________
Pythonmac-SIG maillist  -  [email protected]
https://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG