-
Notifications
You must be signed in to change notification settings - Fork 707
/
Copy pathbuild-lambda-layer.sh
executable file
·107 lines (84 loc) · 2.42 KB
/
build-lambda-layer.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/usr/bin/env bash
set -ex
FILENAME="awswrangler-layer-${1}.zip"
NINJA=${2}
pushd /aws-sdk-pandas
rm -rf python dist/pyarrow_files "dist/${FILENAME}" "${FILENAME}"
popd
rm -rf dist arrow
export ARROW_HOME=$(pwd)/dist
export ARROW_VERSION=18.1.0
export LD_LIBRARY_PATH=$(pwd)/dist/lib:$LD_LIBRARY_PATH
export CMAKE_PREFIX_PATH=$ARROW_HOME:$CMAKE_PREFIX_PATH
export SETUPTOOLS_SCM_PRETEND_VERSION=$ARROW_VERSION
git clone \
--depth 1 \
--branch "apache-arrow-${ARROW_VERSION}" \
--single-branch \
https://github.com/apache/arrow.git
mkdir $ARROW_HOME
mkdir arrow/cpp/build
pushd arrow/cpp/build
cmake \
-DCMAKE_INSTALL_PREFIX=$ARROW_HOME \
-DCMAKE_INSTALL_LIBDIR=lib \
-DARROW_PYTHON=ON \
-DARROW_PARQUET=ON \
-DARROW_DATASET=ON \
-DARROW_WITH_SNAPPY=ON \
-DARROW_WITH_ZLIB=ON \
-DARROW_FLIGHT=OFF \
-DARROW_GANDIVA=OFF \
-DARROW_ORC=OFF \
-DARROW_CSV=ON \
-DARROW_JSON=ON \
-DARROW_COMPUTE=ON \
-DARROW_FILESYSTEM=ON \
-DARROW_PLASMA=OFF \
-DARROW_WITH_BZ2=OFF \
-DARROW_WITH_ZSTD=OFF \
-DARROW_WITH_LZ4=OFF \
-DARROW_WITH_BROTLI=OFF \
-DARROW_BUILD_TESTS=OFF \
-GNinja \
..
eval $NINJA
eval "${NINJA} install"
popd
pushd arrow/python
export CMAKE_PREFIX_PATH=${ARROW_HOME}${CMAKE_PREFIX_PATH:+:${CMAKE_PREFIX_PATH}}
export ARROW_PRE_0_15_IPC_FORMAT=0
export PYARROW_WITH_HDFS=0
export PYARROW_WITH_FLIGHT=0
export PYARROW_WITH_GANDIVA=0
export PYARROW_WITH_ORC=0
export PYARROW_WITH_CUDA=0
export PYARROW_WITH_PLASMA=0
export PYARROW_WITH_PARQUET=1
export PYARROW_WITH_DATASET=1
export PYARROW_WITH_FILESYSTEM=1
export PYARROW_WITH_CSV=1
export PYARROW_WITH_JSON=1
export PYARROW_WITH_COMPUTE=1
python3 setup.py build_ext \
--build-type=release \
--bundle-arrow-cpp \
bdist_wheel
pip3 install dist/pyarrow-*.whl -t /aws-sdk-pandas/dist/pyarrow_files
popd
pushd /aws-sdk-pandas
pip3 install . --no-binary numpy,pandas -t ./python ".[redshift,mysql,postgres,gremlin,opensearch,openpyxl]"
rm -rf python/pyarrow*
rm -rf python/boto*
rm -rf python/urllib3*
rm -rf python/s3transfer*
cp -r /aws-sdk-pandas/dist/pyarrow_files/pyarrow* python/
# Removing nonessential files
find python -name '*.so' -type f -exec strip "{}" \;
find python -wholename "*/tests/*" -type f -delete
find python -regex '^.*\(__pycache__\|\.py[co]\)$' -delete
zip -r9 "${FILENAME}" ./python
mv "${FILENAME}" dist/
rm -rf python dist/pyarrow_files "${FILENAME}"
popd
rm -rf dist arrow