From: Anirudha Bose Date: Thu, 26 May 2016 01:12:06 +0000 (+0530) Subject: pybind: Fix build error in rados/setup.py when invoked through make X-Git-Tag: ses5-milestone5~486^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3b1e510a145d60464f5a06996207b81aaeb6a0e3;p=ceph.git pybind: Fix build error in rados/setup.py when invoked through make The CFLAGS and LDFLAGS were not visible to the dummy librados program when run from top-level make Signed-off-by: Anirudha Bose --- diff --git a/src/pybind/rados/setup.py b/src/pybind/rados/setup.py index f0d2b9bb98d6..4bdfcbd89bee 100755 --- a/src/pybind/rados/setup.py +++ b/src/pybind/rados/setup.py @@ -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: