python package installed with setuptools: fixing permission of the PKG-INFO file

Enrico Maria Crisostomo enrico.m.crisostomo at gmail.com
Fri Mar 23 09:28:38 UTC 2018


Hi all,

I'm working on fixing a `py-tensorflow` port issue (https://trac.macports.org/ticket/55972) and I've found the following problem when building `py-protobuf3`:

    --->  Building py36-protobuf3
    Error: Failed to build py36-protobuf3: command execution failed

The log shows the following:

    :info:build Executing:  cd "/opt/local/var/macports/build/_Users_enrico_repos_github_macports-ports_python_py-protobuf3/py36-protobuf3/work/protobuf-3.5.1/python" && /opt/local/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 setup.py --no-user-cfg build
    :debug:build system:  cd "/opt/local/var/macports/build/_Users_enrico_repos_github_macports-ports_python_py-protobuf3/py36-protobuf3/work/protobuf-3.5.1/python" && /opt/local/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 setup.py --no-user-cfg build
    :info:build Traceback (most recent call last):
    :info:build   File "setup.py", line 12, in <module>
    :info:build     from setuptools import setup, Extension, find_packages
    [...snip...]
    :info:build PermissionError: [Errno 13] Permission denied: '/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/absl_py-0.1.11-py3.6.egg-info/PKG-INFO'

The `py-absl` port is a new port that I've added while fixing this issue.  The `PKG-INFO` file referred to in the log message has the following permissions:

    -rw-r-----  1 root  wheel  889 Mar 23 10:04 /opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/absl_py-0.1.11-py3.6.egg-info/PKG-INFO

I've verified that adding o+r to the permissions fixes the build issue:

    chmod o+r /opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/absl_py-0.1.11-py3.6.egg-info/PKG-INFO

So far so good.  The question now is: what's the best practice to fix _that_ file permissions in the `Portfile`?  The `Portfile` is trivial, uses the `python 1.0` port group and the installation is taken care of by `setuptools`.  Plus, I'm kind of a Python noob.  Is this an installation issue which should be fixed in any one of {upstream, setuptools, python port group, elsewhere}?  Or should I just fix the permissions in the `Portfile` by running `chmod` manually?  In the latter case, I've tried to guess what variables to use to refer to that path on the `post-destroot` phase but I couldn't find the answer.

Thanks for you guidance,
-- 
Enrico


More information about the macports-dev mailing list