Make pygit work in a frozen environment

This commit is contained in:
Michael Sondergaard 2014-11-26 06:04:40 +01:00
parent 21e2102e7c
commit df0e11726e
2 changed files with 6 additions and 1 deletions

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
*.h text eol=lf

View File

@ -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())