]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind: Replace -I with -iquote in cephfs test 10315/head
authorAnirudha Bose <ani07nov@gmail.com>
Tue, 19 Jul 2016 04:34:42 +0000 (10:04 +0530)
committerAnirudha Bose <ani07nov@gmail.com>
Tue, 19 Jul 2016 04:34:42 +0000 (10:04 +0530)
Signed-off-by: Anirudha Bose <ani07nov@gmail.com>
src/pybind/cephfs/setup.py
src/pybind/rados/setup.py

index 3b286af6628f32a259e6a3df1ae0a09bdb3ace4e..4c952997883b722a4eb2c8b3b1cd300efed8d2b0 100755 (executable)
@@ -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 <stddef.h>
-        #include <cephfs/libcephfs.h>
+        #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,
         )
index d1d370a841fbd7181a6aad5a7c51de3f9e345c9a..94e878387d6fe01f16d6052a6f4752fddb279fa1 100755 (executable)
@@ -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"