]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind: Fix build error in rados/setup.py when invoked through make
authorAnirudha Bose <ani07nov@gmail.com>
Thu, 26 May 2016 01:12:06 +0000 (06:42 +0530)
committerAnirudha Bose <ani07nov@gmail.com>
Sun, 19 Jun 2016 14:49:55 +0000 (20:19 +0530)
The CFLAGS and LDFLAGS were not visible to the dummy librados
program when run from top-level make

Signed-off-by: Anirudha Bose <ani07nov@gmail.com>
src/pybind/rados/setup.py

index f0d2b9bb98d6c230268e1a2901b49e52716fc1a1..4bdfcbd89beed78d603630b177ae45a8d398d364 100755 (executable)
@@ -1,5 +1,3 @@
-# Largely taken from
-# https://blog.kevin-brown.com/programming/2014/09/24/combining-autotools-and-setuptools.html
 from __future__ import print_function
 
 import os
@@ -90,12 +88,20 @@ def check_sanity():
     compiler = new_compiler()
     customize_compiler(compiler)
 
+    if set(['MAKEFLAGS', 'MFLAGS', 'MAKELEVEL']).issubset(set(os.environ.keys())):
+        # The setup.py has been invoked by a top-level Ceph make.
+        # Set the appropriate CFLAGS and LDFLAGS
+        CEPH_ROOT = subprocess.check_output(['git', 'rev-parse', '--show-toplevel']).strip().decode('utf-8')
+
+        compiler.add_include_dir(os.path.join(CEPH_ROOT, 'src', 'include'))
+        compiler.add_library_dir(os.path.join(CEPH_ROOT, 'src', '.libs'))
+
     try:
         compiler.link_executable(
             compiler.compile([tmp_file]),
             os.path.join(tmp_dir, 'rados_dummy'),
             libraries=['rados'],
-            output_dir=tmp_dir
+            output_dir=tmp_dir,
         )
 
     except CompileError: