Skip to content

Commit aa35dde

Browse files
committed
build(python): Use meson-python for adbc_driver_manager
1 parent 332e145 commit aa35dde

File tree

12 files changed

+197
-140
lines changed

12 files changed

+197
-140
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,5 +124,5 @@ target/
124124
/ci/linux-packages/yum/tmp/
125125

126126
# Meson subproject support
127-
/c/subprojects/*
128-
!/c/subprojects/*.wrap
127+
**/subprojects/*
128+
!**/subprojects/*.wrap

c/CMakeLists.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,8 @@ if(ADBC_BUILD_PYTHON)
9999
# but you don't technically need -DADBC_DRIVER_MANAGER=ON when installing
100100
# other Python packages. To be safe then, we always install the driver
101101
# manager package, regardless of the value of -DABC_DRIVER_MANAGER
102-
# --config-settings eidtable_mode=compat required due to
103-
# https://github.com/python/mypy/issues/13392
104-
add_custom_target(python
105-
COMMAND ${Python3_EXECUTABLE} -m pip install --no-deps -e
106-
"${REPOSITORY_ROOT}/python/adbc_driver_manager"
107-
--config-settings editable_mode=compat)
102+
add_custom_target(python COMMAND ${Python3_EXECUTABLE} -m pip install --no-deps -e
103+
"${REPOSITORY_ROOT}/python/adbc_driver_manager")
108104

109105
macro(adbc_install_python_package TARGET)
110106
string(TOUPPER ${TARGET} ${TARGET}_LIB_upper)

dev/release/rat_exclude_files.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ go/adbc/status_string.go
2929
go/adbc/infocode_string.go
3030
go/adbc/go.sum
3131
java/.mvn/jvm.config
32+
python/*/subprojects/arrow-adbc/*
3233
python/*/*/py.typed
3334
rat.txt
3435
r/*/DESCRIPTION
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
py.extension_module(
19+
'_backward',
20+
sources: ['_backward.pyx'],
21+
dependencies: [backward_dep],
22+
include_directories: backward_incdir,
23+
override_options: ['cython_language=cpp'],
24+
install: true,
25+
subdir: 'adbc_driver_manager',
26+
)
27+
28+
py.extension_module(
29+
'_lib',
30+
sources: ['_blocking_impl.cc', '_lib.pyx'],
31+
dependencies: [adbc_driver_manager_dep],
32+
override_options: ['cython_language=cpp'],
33+
install: true,
34+
subdir: 'adbc_driver_manager',
35+
)
36+
37+
py.extension_module(
38+
'_reader',
39+
sources: ['_reader.pyx'],
40+
dependencies: [adbc_driver_manager_dep],
41+
override_options: ['cython_language=cpp'],
42+
install: true,
43+
subdir: 'adbc_driver_manager',
44+
)
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
project(
19+
'adbc_driver_manager',
20+
'cython',
21+
version: run_command(
22+
['python', 'adbc_driver_manager/_version.py'],
23+
check: true,
24+
).stdout().replace(
25+
'Version:',
26+
'',
27+
).strip(),
28+
license: 'Apache-2.0',
29+
meson_version: '>=1.2.1',
30+
default_options: ['buildtype=release', 'warning_level=2', 'cpp_std=c++17'],
31+
)
32+
33+
backward_dep = dependency('backward-cpp')
34+
# hack until https://github.com/mesonbuild/wrapdb/pull/2072
35+
backward_incdir = include_directories('subprojects/backward-cpp-1.6')
36+
37+
adbc_driver_manager_dep = dependency(
38+
'adbc-driver-manager',
39+
fallback: ['arrow-adbc', 'adbc_driver_manager_dep'],
40+
default_options: ['driver_manager=enabled'],
41+
)
42+
py = import('python').find_installation(pure: false)
43+
44+
cython_args = []
45+
if get_option('buildtype') in ['debug', 'debugoptimized']
46+
cython_args += ['--gdb']
47+
endif
48+
49+
subdir('adbc_driver_manager')
50+
51+
meson.add_dist_script(py, files('scripts/remove_third_party_wraps.py'))

python/adbc_driver_manager/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ homepage = "https://arrow.apache.org/adbc/"
3434
repository = "https://github.com/apache/arrow-adbc"
3535

3636
[build-system]
37-
requires = ["Cython", "setuptools >= 61.0.0"]
38-
build-backend = "setuptools.build_meta"
37+
requires = ["Cython", "meson-python"]
38+
build-backend = "mesonpy"
3939

4040
[tool.pytest.ini_options]
4141
markers = [
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
# This script is a workaround for the issue described in
19+
# https://github.com/mesonbuild/meson/issues/14520
20+
21+
import os
22+
import pathlib
23+
24+
dist_root = pathlib.Path(os.environ["MESON_DIST_ROOT"])
25+
os.unlink(dist_root / "subprojects" / "nanoarrow.wrap")
26+
os.unlink(dist_root / "subprojects" / "fmt.wrap")

python/adbc_driver_manager/setup.py

Lines changed: 0 additions & 130 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../c/
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
[wrap-file]
19+
directory = backward-cpp-1.6
20+
source_url = https://github.com/bombela/backward-cpp/archive/refs/tags/v1.6.tar.gz
21+
source_filename = backward-cpp-1.6.tar.gz
22+
source_hash = c654d0923d43f1cea23d086729673498e4741fb2457e806cfaeaea7b20c97c10
23+
patch_filename = backward-cpp_1.6-3_patch.zip
24+
patch_url = https://wrapdb.mesonbuild.com/v2/backward-cpp_1.6-3/get_patch
25+
patch_hash = 219b7a62f8f05037586ec90ba02b6d552d356f6f1d1171e5803bbe483daf69f0
26+
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/backward-cpp_1.6-3/backward-cpp-1.6.tar.gz
27+
wrapdb_version = 1.6-3
28+
29+
[provide]
30+
backward-cpp = backward_dep
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
[wrap-redirect]
19+
filename = arrow-adbc/subprojects/fmt.wrap
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
[wrap-redirect]
19+
filename = arrow-adbc/subprojects/nanoarrow.wrap

0 commit comments

Comments
 (0)