Skip to content

Commit

Permalink
Merge pull request #189 from llohse/python-meson
Browse files Browse the repository at this point in the history
Python: modernize build files and metadata
  • Loading branch information
tfarago committed Nov 30, 2022
2 parents 3435f4f + 61df354 commit 188acec
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 1 deletion.
10 changes: 10 additions & 0 deletions python/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
project('ufo-python', 'c',
default_options : ['c_std=c99', 'warning_level=3'],
version : '1.1.0')

pymod = import('python')
py3 = pymod.find_installation(required : true)
py3_dep = py3.dependency()

subdir('src')
subdir('ufo')
14 changes: 14 additions & 0 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[project]
name = 'ufo'
authors = [
{ name = 'Matthias Vogelgesang', email = 'matthias.vogelgesang@kit.edu'},
]
requires_python = '>=3.7'
version = '1.1.0'

[project.urls]
homepage = 'http://ufo.kit.edu'

[build-system]
requires = ['meson', 'ninja', 'meson-python', 'numpy']
build-backend = 'mesonpy'
24 changes: 24 additions & 0 deletions python/src/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
pygobject_dep = dependency('pygobject-3.0', version : '>=3.2.2')
ufo_dep = dependency('ufo', version : '>=0.4.0')

incdir_numpy = run_command(py3,
[
'-c',
'import numpy; print(numpy.get_include())'
],
check: true
).stdout().strip()

inc_np = include_directories(incdir_numpy)
np_dep = declare_dependency(include_directories: inc_np)

src = ['ufo.c']

dependencies = [py3_dep, np_dep, ufo_dep, pygobject_dep]

mod = py3.extension_module('_ufo',
sources : src,
dependencies : dependencies,
install : true,
subdir : 'ufo'
)
9 changes: 9 additions & 0 deletions python/ufo/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
py3.install_sources([
'__init__.py',
'numpy.py',
'tomopy.py'
],
pure : false,
subdir : 'ufo'
)

2 changes: 1 addition & 1 deletion python/ufo/numpy.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from _ufo import asarray, fromarray, fromarray_inplace, empty_like
from ._ufo import asarray, fromarray, fromarray_inplace, empty_like

0 comments on commit 188acec

Please sign in to comment.