Skip to content

Commit f99f95a

Browse files
committed
Modernize Python library installation
1 parent 9c06606 commit f99f95a

2 files changed

Lines changed: 12 additions & 20 deletions

File tree

meson.build

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -48,26 +48,6 @@ pkg.generate(libraries: [lib],
4848
description: 'libwidgetlords',
4949
subdirs: ['widgetlords'])
5050

51-
if get_option('python')
52-
# maybe one day
53-
#py = import('python3')
54-
#message(py.sysconfig_path())
55-
56-
message('Getting python install dir')
57-
r = run_command('python3', '-c', 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')
58-
if r.returncode() != 0
59-
error('Cannot find python install dir')
60-
endif
61-
python_dir = r.stdout().strip()
62-
message(python_dir)
63-
64-
install_data('python/widgetlords/__init__.py',
65-
'python/widgetlords/pi_spi.py',
66-
'python/widgetlords/pi_spi_din.py',
67-
'python/pi_spi_din_4ao_prog.py',
68-
install_dir: join_paths(python_dir, 'widgetlords'))
69-
endif
70-
7151
executable('pi_spi_8ko_demo', 'src/demos/pi_spi_8ko_demo.c', dependencies: [dep])
7252
executable('pi_spi_8ai_demo', 'src/demos/pi_spi_8ai_demo.c', dependencies: [dep])
7353
executable('pi_spi_8ai_16b_demo', 'src/demos/pi_spi_8ai_16b_demo.c', dependencies: [dep])
@@ -85,4 +65,5 @@ executable('pi_spi_din_4freq_demo', 'src/demos/pi_spi_din_4freq_demo.c', depende
8565
executable('vpe_2901a_demo', 'src/demos/vpe_2901a_demo.c', dependencies: [dep])
8666
executable('vpe_3011b_demo', 'src/demos/vpe_3011b_demo.c', dependencies: [dep])
8767

68+
subdir('python')
8869
subdir('overlays')

python/meson.build

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
pymod = import('python')
2+
python = pymod.find_installation('python3', required: false, disabler: true)
3+
4+
python.install_sources(
5+
'pi_spi_din_4ao_prog.py',
6+
'widgetlords/__init__.py',
7+
'widgetlords/pi_spi.py',
8+
'widgetlords/pi_spi_din.py',
9+
subdir: 'widgetlords',
10+
pure: true
11+
)

0 commit comments

Comments
 (0)