Skip to content

Commit f7883c1

Browse files
authored
Merge pull request #161 from keszybz/copy-python-files
meson: copy .py files to build directory
2 parents e77279d + f654998 commit f7883c1

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

meson.build

Lines changed: 13 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(
@@ -26,4 +28,15 @@ update_constants_py = files('update-constants.py')
2628

2729
subdir('src/systemd')
2830

31+
test(
32+
'unit',
33+
find_program(python.full_path()),
34+
args: [
35+
'-m', 'pytest',
36+
'-v',
37+
python_test_dir,
38+
],
39+
env: { 'PYTHONPATH': meson.current_build_dir() / 'src' },
40+
)
41+
2942
alias_target('update-constants', update_constants)

src/systemd/meson.build

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,19 @@ 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
61+
python_test_dir = meson.current_source_dir() / 'test'
5762
python.install_sources(
5863
'test/test_daemon.py',
5964
'test/test_journal.py',
@@ -62,10 +67,11 @@ python.install_sources(
6267
subdir: 'systemd/test',
6368
)
6469

70+
# The 'update-constants' target
6571
include_dir = libsystemd_dep.get_variable(pkgconfig: 'includedir')
6672

6773
update_constants = custom_target(
68-
output: 'update-constants-impl',
74+
output: 'update-constants',
6975
command: [
7076
update_constants_py,
7177
meson.current_source_dir() / 'id128-constants.h',

0 commit comments

Comments
 (0)