forked from apache/arrow-adbc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(c/driver_manager,c/driver/postgres): set up Python sdist build (ap…
…ache#179) Co-authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
- Loading branch information
1 parent
83bd65c
commit 5f5429e
Showing
24 changed files
with
836 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ | |
Cython | ||
pyarrow>=8.0.0 | ||
pytest | ||
setuptools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
set -ex | ||
|
||
source_dir=${1} | ||
|
||
echo "=== (${PYTHON_VERSION}) Building ADBC sdists ===" | ||
|
||
# https://github.com/pypa/pip/issues/7555 | ||
# Get the latest pip so we have in-tree-build by default | ||
pip install --upgrade pip setuptools | ||
|
||
# For drivers, which bundle shared libraries, defer that to install time | ||
export _ADBC_IS_SDIST=1 | ||
|
||
for component in adbc_driver_manager adbc_driver_postgres; do | ||
pushd ${source_dir}/python/$component | ||
|
||
echo "=== (${PYTHON_VERSION}) Building $component sdist ===" | ||
# python -m build copies to a tempdir, so we can't reference other files in the repo | ||
# https://github.com/pypa/pip/issues/5519 | ||
python setup.py sdist | ||
|
||
popd | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
set -e | ||
set -x | ||
set -o pipefail | ||
|
||
if [ "$#" -ne 1 ]; then | ||
echo "Usage: $0 <adbc-src-dir>" | ||
exit 1 | ||
fi | ||
|
||
source_dir=${1} | ||
build_dir="${source_dir}/build" | ||
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
source "${script_dir}/python_util.sh" | ||
|
||
echo "=== (${PYTHON_VERSION}) Building ADBC libpq driver ===" | ||
# Sets ADBC_POSTGRES_LIBRARY | ||
build_drivers "${source_dir}" "${build_dir}" | ||
|
||
echo "=== (${PYTHON_VERSION}) Installing sdists ===" | ||
for component in ${COMPONENTS}; do | ||
pip install --force-reinstall ${source_dir}/python/${component}/dist/*.tar.gz | ||
done | ||
pip install pytest pyarrow pandas | ||
|
||
echo "=== (${PYTHON_VERSION}) Testing sdists ===" | ||
test_packages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
COMPONENTS="adbc_driver_manager adbc_driver_postgres" | ||
|
||
function build_drivers { | ||
local -r source_dir="$1" | ||
local -r build_dir="$2" | ||
|
||
: ${CMAKE_BUILD_TYPE:=release} | ||
: ${CMAKE_UNITY_BUILD:=ON} | ||
: ${CMAKE_GENERATOR:=Ninja} | ||
: ${VCPKG_ROOT:=/opt/vcpkg} | ||
# Enable manifest mode | ||
: ${VCPKG_FEATURE_FLAGS:=manifests} | ||
# Add our custom triplets | ||
: ${VCPKG_OVERLAY_TRIPLETS:="${source_dir}/ci/vcpkg/triplets/"} | ||
|
||
if [[ $(uname) == "Linux" ]]; then | ||
export ADBC_POSTGRES_LIBRARY=${build_dir}/lib/libadbc_driver_postgres.so | ||
export VCPKG_DEFAULT_TRIPLET="x64-linux-static-release" | ||
else # macOS | ||
export ADBC_POSTGRES_LIBRARY=${build_dir}/lib/libadbc_driver_postgres.dylib | ||
export VCPKG_DEFAULT_TRIPLET="x64-osx-static-release" | ||
fi | ||
|
||
echo ${VCPKG_DEFAULT_TRIPLET} | ||
|
||
mkdir -p ${build_dir} | ||
pushd ${build_dir} | ||
|
||
cmake \ | ||
-G ${CMAKE_GENERATOR} \ | ||
-DADBC_BUILD_SHARED=ON \ | ||
-DADBC_BUILD_STATIC=OFF \ | ||
-DCMAKE_INSTALL_LIBDIR=lib \ | ||
-DCMAKE_INSTALL_PREFIX=${build_dir} \ | ||
-DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake \ | ||
-DCMAKE_UNITY_BUILD=${CMAKE_UNITY_BUILD} \ | ||
${source_dir}/c/driver/postgres | ||
cmake --build . --target install -j | ||
popd | ||
} | ||
|
||
function test_packages { | ||
python -c " | ||
import adbc_driver_manager | ||
import adbc_driver_manager.dbapi | ||
import adbc_driver_postgres | ||
import adbc_driver_postgres.dbapi | ||
" | ||
|
||
# Will only run some smoke tests | ||
# --import-mode required, else tries to import from the source dir instead of installed package | ||
echo "=== Testing adbc_driver_manager ===" | ||
python -m pytest -vvx --import-mode append -k "not sqlite" ${source_dir}/python/adbc_driver_manager/tests | ||
echo "=== Testing adbc_driver_postgres ===" | ||
python -m pytest -vvx --import-mode append ${source_dir}/python/adbc_driver_postgres/tests | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
# setuptools manifest | ||
|
||
include adbc_driver_manager/adbc.h | ||
include adbc_driver_manager/adbc_driver_manager.cc | ||
include adbc_driver_manager/adbc_driver_manager.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.