You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2018/08/28 16:38:58 UTC

[arrow] branch master updated: ARROW-2734: [Python] Cython api example doesn't work by default on macOS

This is an automated email from the ASF dual-hosted git repository.

wesm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 0311f63  ARROW-2734: [Python] Cython api example doesn't work by default on macOS
0311f63 is described below

commit 0311f6336f0a350d7bf665d04f484cec4cdb2a85
Author: Krisztián Szűcs <sz...@gmail.com>
AuthorDate: Tue Aug 28 12:38:48 2018 -0400

    ARROW-2734: [Python] Cython api example doesn't work by default on macOS
    
    Author: Krisztián Szűcs <sz...@gmail.com>
    
    Closes #2488 from kszucs/ARROW-2734 and squashes the following commits:
    
    0d65b936 <Krisztián Szűcs> fix cython example in pyarrow documentation
---
 python/doc/source/extending.rst | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/python/doc/source/extending.rst b/python/doc/source/extending.rst
index e3d8707..6b5c9ce 100644
--- a/python/doc/source/extending.rst
+++ b/python/doc/source/extending.rst
@@ -312,6 +312,7 @@ the underlying C++ object's API.
 
    from pyarrow.lib cimport *
 
+
    def get_array_length(obj):
        # Just an example function accessing both the pyarrow Cython API
        # and the Arrow C++ API
@@ -328,10 +329,11 @@ To build this module, you will need a slightly customized ``setup.py`` file
     from distutils.core import setup
     from Cython.Build import cythonize
 
+    import os
     import numpy as np
-
     import pyarrow as pa
 
+
     ext_modules = cythonize("example.pyx")
 
     for ext in ext_modules:
@@ -340,10 +342,20 @@ To build this module, you will need a slightly customized ``setup.py`` file
         ext.include_dirs.append(pa.get_include())
         ext.libraries.extend(pa.get_libraries())
         ext.library_dirs.extend(pa.get_library_dirs())
-        # Try uncommenting the following line on Linux if you otherwise
-        # get weird linker errors or runtime crashes
-        #ext.define_macros.append(("_GLIBCXX_USE_CXX11_ABI", "0"))
 
-    setup(
-        ext_modules=ext_modules,
-    )
+        if os.name == 'posix':
+            ext.extra_compile_args.append('-std=c++11')
+
+        # Try uncommenting the following line on Linux
+        # if you get weird linker errors or runtime crashes
+        # ext.define_macros.append(("_GLIBCXX_USE_CXX11_ABI", "0"))
+
+
+    setup(ext_modules=ext_modules)
+
+
+Compile the extension:
+
+.. code-block:: bash
+
+    python setup.py build_ext --inplace