Binary OSX installer for Python extension without admin rights

109 views Asked by At

I am packing up a Python extension in an mpkg, to create an OSX installer. The mpkg is then put in a dmg file. This can be done easily with distutils and bdist_mpkg:

python setup.py build_ext
python setup.py bdist_mpkg
hdiutil create -layout NONE -srcfolder $MPKG $DMG

The only problem is that bdist_mpkg sets the group and mode of the files in the mpkg by doing:

spawn(['/usr/bin/chgrp', '-R', 'admin', src])
spawn(['/bin/chmod', '-R', 'g+w', src])

which fails, because the user building the installer is not in the admin group. The dmg is still built, because the chgrp and chmod are in a try block. The dmg is built daily, on a build server, and I don't want to give admin permissions to the user that does the build.

My questions would be:

  1. Is it really necessary to set the group and the mode?
  2. If it is, then can I do it with some tool, after the dmg is built?

If there is nothing else, I can write a script to set the group and mode, and then use sudo, but it would be nice to have a proper solution.

Thanks a lot!

0

There are 0 answers