| 1 |
project('python sample', 'c') |
| 2 |
|
| 3 |
py3_mod = import('python3') |
| 4 |
py3 = py3_mod.find_python() |
| 5 |
|
| 6 |
py3_version = py3_mod.language_version() |
| 7 |
if py3_version.version_compare('< 3.2') |
| 8 |
error('Invalid python version!?') |
| 9 |
endif |
| 10 |
|
| 11 |
py3_purelib = py3_mod.sysconfig_path('purelib') |
| 12 |
message('Python purelib:', py3_purelib) |
| 13 |
if not (py3_purelib.endswith('site-packages') or py3_purelib.endswith('dist-packages')) |
| 14 |
error('Python3 purelib path seems invalid?') |
| 15 |
endif |
| 16 |
|
| 17 |
# could be 'lib64' or 'Lib' on some systems |
| 18 |
py3_platlib = py3_mod.sysconfig_path('platlib') |
| 19 |
message('Python platlib:', py3_platlib) |
| 20 |
if not (py3_platlib.endswith('site-packages') or py3_platlib.endswith('dist-packages')) |
| 21 |
error('Python3 platlib path seems invalid?') |
| 22 |
endif |
| 23 |
|
| 24 |
# could be 'Include' on Windows |
| 25 |
py3_include = py3_mod.sysconfig_path('include') |
| 26 |
if not py3_include.to_lower().startswith('include') |
| 27 |
error('Python3 include path seems invalid?') |
| 28 |
endif |
| 29 |
|
| 30 |
main = files('prog.py') |
| 31 |
|
| 32 |
test('toplevel', py3, args : main) |
| 33 |
|
| 34 |
subdir('subdir') |