Skip to content

Commit

Permalink
Make pygit work in a frozen environment
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheeo committed Nov 26, 2014
1 parent 21e2102 commit df0e117
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.h text eol=lf
6 changes: 5 additions & 1 deletion pygit2/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit df0e117

Please sign in to comment.