[pypy-commit] pypy default: issue #1977

arigo noreply at buildbot.pypy.org
Wed Feb 11 16:52:26 CET 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r75827:9249bb18f160
Date: 2015-02-11 16:52 +0100
http://bitbucket.org/pypy/pypy/changeset/9249bb18f160/

Log:	issue #1977

	patch by David Naylor: support FreeBSD

diff --git a/lib_pypy/gdbm.py b/lib_pypy/gdbm.py
--- a/lib_pypy/gdbm.py
+++ b/lib_pypy/gdbm.py
@@ -1,4 +1,4 @@
-import cffi, os
+import cffi, os, sys
 
 ffi = cffi.FFI()
 ffi.cdef('''
@@ -37,9 +37,19 @@
 ''')
 
 try:
-    lib = ffi.verify('''
-    #include "gdbm.h"
-    ''', libraries=['gdbm'])
+    if sys.platform.startswith('freebsd'):
+        import os.path
+        _localbase = os.environ.get('LOCALBASE', '/usr/local')
+        lib = ffi.verify('''
+        #include "gdbm.h"
+        ''', libraries=['gdbm'],
+             include_dirs=[os.path.join(_localbase, 'include')],
+             library_dirs=[os.path.join(_localbase, 'lib')]
+        )
+    else:
+        lib = ffi.verify('''
+        #include "gdbm.h"
+        ''', libraries=['gdbm'])
 except cffi.VerificationError as e:
     # distutils does not preserve the actual message,
     # but the verification is simple enough that the


More information about the pypy-commit mailing list