From 68b80a83876b1306f80d3914eef98f51100a8009 Mon Sep 17 00:00:00 2001 From: Wes McKinney Date: Sat, 14 May 2016 18:53:22 -0700 Subject: [PATCH] ARROW-197: Working first draft of a conda recipe for pyarrow Includes ARROW-196. I will close that PR and merge these together as I had to make some additional changes. Requires PARQUET-617. Closes #76 Author: Wes McKinney Closes #77 from wesm/ARROW-197 and squashes the following commits: 4bf3d2c [Wes McKinney] Finagle toolchain environment variables to get pyarrow conda package working c2d3684 [Wes McKinney] Add conda recipe and ensure that libarrow_parquet is installed as well --- cpp/conda.recipe/build.sh | 45 ++++++++++++++++++++++++++++ cpp/conda.recipe/meta.yaml | 32 ++++++++++++++++++++ cpp/src/arrow/parquet/CMakeLists.txt | 7 +++++ cpp/src/arrow/types/primitive.h | 1 + python/conda.recipe/build.sh | 18 +++++++++++ python/conda.recipe/meta.yaml | 41 +++++++++++++++++++++++++ 6 files changed, 144 insertions(+) create mode 100644 cpp/conda.recipe/build.sh create mode 100644 cpp/conda.recipe/meta.yaml create mode 100644 python/conda.recipe/build.sh create mode 100644 python/conda.recipe/meta.yaml diff --git a/cpp/conda.recipe/build.sh b/cpp/conda.recipe/build.sh new file mode 100644 index 0000000000000..ac1f9c89cc9ed --- /dev/null +++ b/cpp/conda.recipe/build.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +set -e +set -x + +cd $RECIPE_DIR + +# Build dependencies +export FLATBUFFERS_HOME=$PREFIX +export PARQUET_HOME=$PREFIX + +cd .. + +rm -rf conda-build +mkdir conda-build + +cp -r thirdparty conda-build/ + +cd conda-build +pwd + +# Build googletest for running unit tests +./thirdparty/download_thirdparty.sh +./thirdparty/build_thirdparty.sh gtest + +source thirdparty/versions.sh +export GTEST_HOME=`pwd`/thirdparty/$GTEST_BASEDIR + +if [ `uname` == Linux ]; then + SHARED_LINKER_FLAGS='-static-libstdc++' +elif [ `uname` == Darwin ]; then + SHARED_LINKER_FLAGS='' +fi + +cmake \ + -DCMAKE_BUILD_TYPE=debug \ + -DCMAKE_INSTALL_PREFIX=$PREFIX \ + -DCMAKE_SHARED_LINKER_FLAGS=$SHARED_LINKER_FLAGS \ + -DARROW_IPC=on \ + -DARROW_PARQUET=on \ + .. + +make +ctest -L unittest +make install diff --git a/cpp/conda.recipe/meta.yaml b/cpp/conda.recipe/meta.yaml new file mode 100644 index 0000000000000..2e834d5cbf86c --- /dev/null +++ b/cpp/conda.recipe/meta.yaml @@ -0,0 +1,32 @@ +package: + name: arrow-cpp + version: "0.1" + +build: + number: {{environ.get('TRAVIS_BUILD_NUMBER', 0)}} # [unix] + skip: true # [win] + script_env: + - CC [linux] + - CXX [linux] + - LD_LIBRARY_PATH [linux] + +requirements: + build: + - cmake + - flatbuffers + - parquet-cpp + - thrift-cpp + + run: + - parquet-cpp + +test: + commands: + - test -f $PREFIX/lib/libarrow.so + - test -f $PREFIX/lib/libarrow_parquet.so + - test -f $PREFIX/include/arrow/api.h + +about: + home: http://github.com/apache/arrow + license: Apache 2.0 + summary: 'C++ libraries for the reference Apache Arrow implementation' diff --git a/cpp/src/arrow/parquet/CMakeLists.txt b/cpp/src/arrow/parquet/CMakeLists.txt index 1ae6709652ea5..cd6f05d6b5f8a 100644 --- a/cpp/src/arrow/parquet/CMakeLists.txt +++ b/cpp/src/arrow/parquet/CMakeLists.txt @@ -42,4 +42,11 @@ ARROW_TEST_LINK_LIBRARIES(parquet-reader-test arrow_parquet) # Headers: top level install(FILES + reader.h + schema.h + utils.h DESTINATION include/arrow/parquet) + +install(TARGETS arrow_parquet + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) diff --git a/cpp/src/arrow/types/primitive.h b/cpp/src/arrow/types/primitive.h index 6f6b2fed5a320..fc45f6c5b0568 100644 --- a/cpp/src/arrow/types/primitive.h +++ b/cpp/src/arrow/types/primitive.h @@ -136,6 +136,7 @@ class NumericBuilder : public PrimitiveBuilder { using PrimitiveBuilder::Append; using PrimitiveBuilder::Init; using PrimitiveBuilder::Resize; + using PrimitiveBuilder::Reserve; // Scalar append. void Append(value_type val) { diff --git a/python/conda.recipe/build.sh b/python/conda.recipe/build.sh new file mode 100644 index 0000000000000..a9d9aedead399 --- /dev/null +++ b/python/conda.recipe/build.sh @@ -0,0 +1,18 @@ +#!/bin/bash +set -ex + +# Build dependency +export ARROW_HOME=$PREFIX + +cd $RECIPE_DIR + +echo Setting the compiler... +if [ `uname` == Linux ]; then + EXTRA_CMAKE_ARGS=-DCMAKE_SHARED_LINKER_FLAGS=-static-libstdc++ +elif [ `uname` == Darwin ]; then + EXTRA_CMAKE_ARGS= +fi + +cd .. +$PYTHON setup.py build_ext --extra-cmake-args=$EXTRA_CMAKE_ARGS || exit 1 +$PYTHON setup.py install || exit 1 diff --git a/python/conda.recipe/meta.yaml b/python/conda.recipe/meta.yaml new file mode 100644 index 0000000000000..85d24b6bc322e --- /dev/null +++ b/python/conda.recipe/meta.yaml @@ -0,0 +1,41 @@ +package: + name: pyarrow + version: "0.1" + +build: + number: {{environ.get('TRAVIS_BUILD_NUMBER', 0)}} # [unix] + rpaths: + - lib # [unix] + - lib/python{{environ.get('PY_VER')}}/site-packages/pyarrow # [unix] + script_env: + - CC [linux] + - CXX [linux] + - LD_LIBRARY_PATH [linux] + skip: true # [win] + +requirements: + build: + - cmake + - python + - setuptools + - cython + - numpy + - pandas + - arrow-cpp + - pytest + + run: + - arrow-cpp + - python + - numpy + - pandas + - six + +test: + imports: + - pyarrow + +about: + home: http://github.com/apache/arrow + license: Apache 2.0 + summary: 'Python bindings for Arrow C++ and interoperability tool for pandas and NumPy'