Skip to content

Commit 33f1a77

Browse files
committed
Use symlinks for NOTICE/LICENSE.txt
1 parent 99ea49d commit 33f1a77

File tree

4 files changed

+46
-2
lines changed

4 files changed

+46
-2
lines changed

python/LICENSE.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../LICENSE.txt

python/NOTICE.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../NOTICE.txt

python/meson.build

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,21 @@ project(
2727
check: true,
2828
).stdout().strip(),
2929
license: 'Apache-2.0',
30-
#license_files: ['../LICENSE.txt'],
30+
license_files: ['LICENSE.txt'],
3131
meson_version: '>=1.4.0',
3232
default_options: ['buildtype=release', 'cpp_std=c++17'],
3333
)
3434

3535
py = import('python').find_installation(pure: false)
3636

37-
#install_data('../NOTICE.txt', install_dir: py.get_install_dir() / 'pyarrow')
37+
install_data('NOTICE.txt', install_dir: py.get_install_dir() / 'pyarrow')
38+
# Meson-python suggests using a dist script to resolve symlinks to physical
39+
# files when creating the sdist. See
40+
# https://github.com/mesonbuild/meson-python/discussions/823#discussioncomment-15078932
41+
meson.add_dist_script(
42+
py,
43+
meson.project_source_root() / 'scripts/generate_dist.py',
44+
)
3845

3946
if get_option('default_library') == 'static'
4047
cmake_suffix = 'static'

python/scripts/generate_dist.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
import os
19+
import pathlib
20+
import shutil
21+
22+
23+
def main():
24+
src_dir = pathlib.Path(os.environ["MESON_SOURCE_ROOT"])
25+
parent_dir = src_dir.parent.resolve()
26+
dest_dir = pathlib.Path(os.environ["MESON_DIST_ROOT"]).resolve()
27+
28+
license_file = parent_dir / 'LICENSE.txt'
29+
shutil.copy(license_file, dest_dir)
30+
notice_file = parent_dir / 'NOTICE.txt'
31+
shutil.copy(notice_file, dest_dir)
32+
33+
34+
if __name__ == "__main__":
35+
main()

0 commit comments

Comments
 (0)