dimanche 8 mars 2015

How to get correct file permissions from Macports pip installs?


Macports sets up the ownership of its Python site-packages directory as root.wheel.



# ls -l -d /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
drwxr-xr-x 151 root wheel 5134 Mar 8 10:56 /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages


This of course prevents individual users from using pip install to add packages, which is just fine since that really ought to be done as root.


However, if one uses sudo or a root shell to install, the packages are installed as readable only by root.wheel (740).



% sudo pip install BeautifulSoup
...
% ls -l -d /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/BeautifulSoup.py
-rw-r----- 1 root wheel 79567 Mar 8 11:09 /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/BeautifulSoup.py


This precludes my user account from actually importing or using the package, at least until I remember about the issue and chmod a+rX the proper permissions (744/755) onto the newly installed package files.


How can I get pip to always put reasonable permissions on installed packages?





Aucun commentaire:

Enregistrer un commentaire