From: Anirudha Bose Date: Tue, 19 Jul 2016 04:34:42 +0000 (+0530) Subject: pybind: Replace -I with -iquote in cephfs test X-Git-Tag: ses5-milestone5~349^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d0ff714834dddece6cc86e81a77d153ad857a84f;p=ceph.git pybind: Replace -I with -iquote in cephfs test Signed-off-by: Anirudha Bose --- diff --git a/src/pybind/cephfs/setup.py b/src/pybind/cephfs/setup.py index 3b286af6628f..4c952997883b 100755 --- a/src/pybind/cephfs/setup.py +++ b/src/pybind/cephfs/setup.py @@ -63,6 +63,11 @@ def check_sanity(): """ Test if development headers and library for cephfs is available by compiling a dummy C program. """ + CEPH_SRC_DIR = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + '..', + '..' + ) tmp_dir = tempfile.mkdtemp(dir=os.environ.get('TMPDIR', os.path.dirname(__file__))) tmp_file = os.path.join(tmp_dir, 'cephfs_dummy.c') @@ -70,7 +75,7 @@ def check_sanity(): with open(tmp_file, 'w') as fp: dummy_prog = textwrap.dedent(""" #include - #include + #include "cephfs/libcephfs.h" int main(void) { struct ceph_mount_info *cmount = NULL; @@ -86,21 +91,21 @@ def check_sanity(): if {'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_SRC_DIR = os.path.join( - os.path.dirname(os.path.abspath(__file__)), - '..', - '..' - ) - compiler.set_include_dirs(os.path.join(CEPH_SRC_DIR, 'include')) - compiler.add_library_dir(os.environ.get('CEPH_LIBDIR')) + compiler.set_library_dirs([os.environ.get('CEPH_LIBDIR')]) try: compiler.define_macro('_FILE_OFFSET_BITS', '64') + link_objects = compiler.compile( + sources=[tmp_file], + output_dir=tmp_dir, + extra_preargs=['-iquote{path}'.format(path=os.path.join(CEPH_SRC_DIR, 'include'))] + ) + compiler.link_executable( - compiler.compile([tmp_file], tmp_dir), - os.path.join(tmp_dir, 'cephfs_dummy'), + objects=link_objects, + output_progname=os.path.join(tmp_dir, 'cephfs_dummy'), libraries=['cephfs', 'rados'], output_dir=tmp_dir, ) diff --git a/src/pybind/rados/setup.py b/src/pybind/rados/setup.py index d1d370a841fb..94e878387d6f 100755 --- a/src/pybind/rados/setup.py +++ b/src/pybind/rados/setup.py @@ -76,6 +76,11 @@ def check_sanity(): """ Test if development headers and library for rados is available by compiling a dummy C program. """ + CEPH_SRC_DIR = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + '..', + '..' + ) tmp_dir = tempfile.mkdtemp(dir=os.environ.get('TMPDIR', os.path.dirname(__file__))) tmp_file = os.path.join(tmp_dir, 'rados_dummy.c') @@ -98,19 +103,18 @@ def check_sanity(): if {'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_SRC_DIR = os.path.join( - os.path.dirname(os.path.abspath(__file__)), - '..', - '..' - ) - compiler.set_include_dirs(os.path.join(CEPH_SRC_DIR, 'include')) - compiler.add_library_dir(os.environ.get('CEPH_LIBDIR')) + compiler.set_include_dirs([os.path.join(CEPH_SRC_DIR, 'include')]) + compiler.set_library_dirs([os.environ.get('CEPH_LIBDIR')]) try: + link_objects = compiler.compile( + sources=[tmp_file], + output_dir=tmp_dir + ) compiler.link_executable( - compiler.compile([tmp_file], tmp_dir), - os.path.join(tmp_dir, 'rados_dummy'), + objects=link_objects, + output_progname=os.path.join(tmp_dir, 'rados_dummy'), libraries=['rados'], output_dir=tmp_dir, ) @@ -134,6 +138,7 @@ cmdclass = {} try: from Cython.Build import cythonize from Cython.Distutils import build_ext + cmdclass = {'build_ext': build_ext} except ImportError: print("WARNING: Cython is not installed.") @@ -144,6 +149,7 @@ except ImportError: else: def cythonize(x, **kwargs): return x + source = "rados.c" else: source = "rados.pyx"