Skip to content

Commit 8e9ab67

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

File tree

9 files changed

+193
-134
lines changed

9 files changed

+193
-134
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
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: 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)