Repository navigation
Runtime failures delivered by multiple package managers #558
Description
Hello,
I was using Pygit2 as packaged by MacPorts successfully a week or three ago. I've been keeping my MacPorts tree up to date regularly. Today, I tried using Pygit2 again (port py34-pygit2), and I received an asynchronous error. The traceback started after I receive the prompt for the next command.
$ python3.4
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.54)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygit2
>>> Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pygit2/__init__.py", line 35, in <module>
from .blame import Blame, BlameHunk
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pygit2/blame.py", line 32, in <module>
from .errors import check_error
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pygit2/errors.py", line 29, in <module>
from .ffi import ffi, C
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pygit2/ffi.py", line 35, in <module>
ffi, C = get_ffi()
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pygit2/_utils.py", line 107, in get_ffi
include_dirs=[libgit2_include], library_dirs=[libgit2_lib])
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/cffi/api.py", line 405, in verify
lib = self.verifier.load_library()
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/cffi/verifier.py", line 99, in load_library
self._write_source()
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/cffi/verifier.py", line 187, in _write_source
with open(self.sourcefilename, "w") as fp:
PermissionError: [Errno 13] Permission denied: '/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pygit2/__pycache__/pygit2_cffi_a295dec8x2a59b7ee.c'
This issue looks similar to the build failure currently being experienced in the next Ubuntu's nightly builds. According to the Launchpad issue tracker, the upstream Debian issue has not been resolved yet.
It looks like this is related to a cffi update, according to Issue 534.
So it's clear: Pygit2 currently fails as packaged by three operating systems using two package management systems. It looks like at least one additional file needs to be built during the build scripts, but I'm not sure if that's the correct solution or a hack.
Activity
galactics commentedon Aug 30, 2015
I have the same problem with ArchLinux,
I found a way to get around the problem, by installing everything in the user .local folder.
But it's not a good long term solution
jdavid commentedon Sep 2, 2015
My hypothesis...
So pygit2 is installed system wide, the cffi extension should be built and installed, and probably it is. But when importing it is not found, so it tries to generate it at runtime. Since all this happens as a regular user, without write access, you get an error.
The name of the cffi extension is defined by https://github.com/libgit2/pygit2/blob/master/pygit2/_utils.py#L75 and depends on a number of variables, like the version of cffi. This means for instance that the binary package in your distribution needs to be updated every time there is a new version of cffi.
For context you may check issue #441
One possible solution would be to reduce the number of variables the name of the cffi extension depends
on.
But then there is #529 ... I have to check how the new method works.
jdavid commentedon Sep 2, 2015
Interesting, it looks like the name is constant with the new method.
Before:
After:
Looks like a good reason to merge #529 and drop support for older versions of cffi.
ajnelson-nist commentedon Sep 14, 2015
I updated MacPorts today and saw pygit2 and some dependencies were changed. Pygit2 now functions as expected on OS X.
I also tested the Ubuntu nightly build, and found it was fixed. Debian reports a fix as well. It looks like this issue is resolved. Thank you.