Skip to content

Commit 17016e1

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 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 e6877e5 commit 17016e1

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
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: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +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',
5453
)
5554

56-
# Install test modules
55+
python.install_sources(py_files, subdir: 'systemd')
56+
foreach file: py_files
57+
fs.copyfile(file)
58+
endforeach
59+
60+
# Test code
5761
python.install_sources(
5862
'test/test_daemon.py',
5963
'test/test_journal.py',
@@ -62,6 +66,7 @@ python.install_sources(
6266
subdir: 'systemd/test',
6367
)
6468

69+
# The 'update-constants' target
6570
include_dir = libsystemd_dep.get_variable(pkgconfig: 'includedir')
6671

6772
update_constants = custom_target(

0 commit comments

Comments
 (0)