Tweak include/lib dir detection in ffi.py#382
Tweak include/lib dir detection in ffi.py#382jdavid merged 1 commit intolibgit2:masterfrom jasperla:libgit2_prefix
Conversation
|
Won't this fail to find a system-provided libgit2? |
|
Then https://github.com/libgit2/pygit2/blob/master/setup.py#L57 would fail too, no? |
|
It seems Travis is having issues with this too. The problem I was trying to solve is that on OpenBSD |
|
Travis is having issues because you've removed the logic that sets the correct path in case that there is a |
|
If your includes live under |
|
Sorry, I was looking at |
|
Here's the build log from my system: https://gist.github.com/jasperla/288c643e16fc3b59b64c (without the proposed patch) |
|
What I'm thinking of is something like this, which lets the current logic do the work and adds the fallback we have in setup. diff --git a/pygit2/ffi.py b/pygit2/ffi.py
index 0dba2f3..b776dec 100644
--- a/pygit2/ffi.py
+++ b/pygit2/ffi.py
@@ -112,11 +112,13 @@ with codecs.open(decl_path, 'r', 'utf-8') as header:
# if LIBGIT2 exists, set build and link against that version
libgit2_path = getenv('LIBGIT2')
+if not libgit2_path:
+ libgit2_path = '/usr/local'
+
include_dirs = []
library_dirs = []
-if libgit2_path:
- include_dirs = [path.join(libgit2_path, 'include')]
- library_dirs = [path.join(libgit2_path, 'lib')]
+include_dirs = [path.join(libgit2_path, 'include')]
+library_dirs = [path.join(libgit2_path, 'lib')]
C = ffi.verify("#include <git2.h>", libraries=["git2"],
include_dirs=include_dirs, library_dirs=library_dirs) |
Joint work with @carlosmn
|
That worked better indeed. |
This is similar to what's done in setup.py by using sane defaults,
instead of just failing if git2.h is located in /usr/local .