diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6e4f5d2 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.h text eol=lf diff --git a/pygit2/_utils.py b/pygit2/_utils.py index 9c13d9b..3e7c54a 100644 --- a/pygit2/_utils.py +++ b/pygit2/_utils.py @@ -79,7 +79,11 @@ def get_ffi(): ffi = cffi.FFI() # Load C definitions - dir_path = dirname(abspath(inspect.getfile(inspect.currentframe()))) + if getattr(sys, 'frozen', False): + dir_path = dirname(abspath(sys.executable)) + else: + dir_path = dirname(abspath(__file__)) + decl_path = os.path.join(dir_path, 'decl.h') with codecs.open(decl_path, 'r', 'utf-8') as header: ffi.cdef(header.read())