Skip to content

Commit d7809a1

Browse files
committed
meson: copy .py files to build directory
This seems to do the trick: $ ninja -C build $ PYTHONPATH=build/src/ python -c 'from systemd import id128; print(id128)' <module 'systemd.id128' from '/home/zbyszek/src/python-systemd/build/src/systemd/id128.cpython-313-x86_64-linux-gnu.so'> $ PYTHONPATH=build/src/ pytest build/src/systemd/test ... ============================ test session starts ============================= platform linux -- Python 3.13.4, pytest-8.3.4, pluggy-1.5.0 rootdir: /home/zbyszek/src/python-systemd configfile: pyproject.toml plugins: ... collected 61 items build/src/systemd/test/test_daemon.py ........................ [ 39%] build/src/systemd/test/test_id128.py .... [ 45%] build/src/systemd/test/test_journal.py ............................ [ 91%] build/src/systemd/test/test_login.py ..... [100%] ============================= 61 passed in 0.21s =============================
1 parent 1afbdab commit d7809a1

File tree

3 files changed

+25
-11
lines changed

3 files changed

+25
-11
lines changed

meson.build

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ project(
1313
python = import('python').find_installation('python3', pure: false)
1414
python_dep = python.dependency()
1515

16+
fs = import('fs')
17+
1618
libsystemd_dep = dependency('libsystemd')
1719

1820
add_project_arguments(

src/systemd/meson.build

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,18 @@ python.extension_module(
4646
)
4747

4848
# Install Python modules
49-
python.install_sources(
49+
py_files = files(
5050
'__init__.py',
5151
'journal.py',
5252
'daemon.py',
53-
subdir: 'systemd',
54-
)
53+
)
5554

56-
# Install test modules
57-
python.install_sources(
58-
'test/test_daemon.py',
59-
'test/test_journal.py',
60-
'test/test_login.py',
61-
'test/test_id128.py',
62-
subdir: 'systemd/test',
63-
)
55+
python.install_sources(py_files, subdir: 'systemd')
56+
foreach file: py_files
57+
fs.copyfile(file)
58+
endforeach
6459

60+
# The 'update-constants' target
6561
include_dir = libsystemd_dep.get_variable(pkgconfig: 'includedir')
6662

6763
update_constants = custom_target(
@@ -73,3 +69,5 @@ update_constants = custom_target(
7369
meson.current_source_dir() / 'id128-defines.h',
7470
include_dir / 'systemd/sd-messages.h',
7571
])
72+
73+
subdir('test')

src/systemd/test/meson.build

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# SPDX-License-Identifier: LGPL-2.1-or-later
2+
3+
# Install test modules
4+
py_files = files(
5+
'test_daemon.py',
6+
'test_journal.py',
7+
'test_login.py',
8+
'test_id128.py',
9+
)
10+
11+
python.install_sources(py_files, subdir: 'systemd/test')
12+
foreach file: py_files
13+
fs.copyfile(file)
14+
endforeach

0 commit comments

Comments
 (0)