Skip to content

Commit

Permalink
Switch to meson-python as packaging python backend
Browse files Browse the repository at this point in the history
Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
  • Loading branch information
jeandet committed Jul 26, 2022
1 parent 8912a3c commit 6140b14
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 37 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/pythonpublish-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,30 @@ jobs:
- name: install deps
run: |
yum install -y ninja-build
/opt/python/cp310-cp310/bin/pip install --user --upgrade "meson<=0.61.4" "twine"
/opt/python/cp310-cp310/bin/pip install --user --upgrade "meson" "twine"
- uses: actions/checkout@v3
with:
submodules: true
- name: Build for Python 3.7
run: |
/opt/python/cp37-cp37m/bin/pip install --user --upgrade "meson<=0.61.4" "ninja"
/opt/python/cp37-cp37m/bin/python -m build . --config-setting=--setup-args="-Dbuildtype=release"
/opt/python/cp37-cp37m/bin/pip install --user --upgrade "meson" "ninja"
/opt/python/cp37-cp37m/bin/python -m build .
- name: Build for Python 3.8
run: |
/opt/python/cp38-cp38/bin/pip install --user --upgrade "meson<=0.61.4" "ninja"
/opt/python/cp38-cp38/bin/python -m build . --config-setting=--setup-args="-Dbuildtype=release"
/opt/python/cp38-cp38/bin/pip install --user --upgrade "meson" "ninja"
/opt/python/cp38-cp38/bin/python -m build .
- name: Build for Python 3.9
run: |
/opt/python/cp39-cp39/bin/pip install --user --upgrade "meson<=0.61.4" "ninja"
/opt/python/cp39-cp39/bin/python -m build . --config-setting=--setup-args="-Dbuildtype=release"
/opt/python/cp39-cp39/bin/pip install --user --upgrade "meson" "ninja"
/opt/python/cp39-cp39/bin/python -m build .
- name: Build for Python 3.10
run: |
/opt/python/cp310-cp310/bin/pip install --user --upgrade "meson<=0.61.4" "ninja"
/opt/python/cp310-cp310/bin/python -m build . --config-setting=--setup-args="-Dbuildtype=release"
/opt/python/cp310-cp310/bin/pip install --user --upgrade "meson" "ninja"
/opt/python/cp310-cp310/bin/python -m build .
- name: Build for Python 3.11
run: |
/opt/python/cp311-cp311/bin/pip install --user --upgrade "meson<=0.61.4" "ninja"
/opt/python/cp311-cp311/bin/python -m build . --config-setting=--setup-args="-Dbuildtype=release"
/opt/python/cp311-cp311/bin/pip install --user --upgrade "meson" "ninja"
/opt/python/cp311-cp311/bin/python -m build .
- name: Make wheels universal
run: for wheel in $(ls dist/*.whl); do auditwheel repair $wheel; done
- name: Publish on PyPi
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/pythonpublish-osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ jobs:
python-version: ${{ matrix.python-version }}
architecture: x64
- run: |
pip install --upgrade twine build ninja meson==0.61.4
CC=gcc-11 CXX=g++-11 python -m build . --config-setting=--setup-args="-Dbuildtype=release"
pip install --upgrade twine build ninja meson
CC=gcc-11 CXX=g++-11 python -m build .
for f in dist/pycdfpp-*-any.whl; do mv $f "$(echo $f | sed s/any/macosx_10_15_x86_64/)"; done
- name: Publish on PyPi
env:
TWINE_USERNAME: __token__
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/pythonpublish-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ jobs:
python-version: ${{ matrix.python-version }}
architecture: x64
- run: |
pip install --upgrade twine build ninja wheel meson==0.61.4
python -m build . --config-setting=--setup-args="-Dbuildtype=release"
pip install --upgrade twine build ninja wheel meson
python -m build .
for f in dist/pycdfpp-*-any.whl; do mv $f "$(echo $f | sed s/any/win_amd64/)"; done
- name: Publish on PyPi
env:
TWINE_USERNAME: __token__
Expand Down
21 changes: 7 additions & 14 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ cdfpp_extra_files = [
'.github/workflows/pythonpublish-win.yml'
]


cdfpp_lib = library('CDFpp',
include_directories: include_directories('include'),
dependencies: [zlib_dep, hedley_dep],
extra_files: [cdfpp_headers, cdfpp_extra_files]
)

if get_option('show_extra_files')
cdfpp_lib = static_library('CDFpp',
include_directories: include_directories('include'),
dependencies: [zlib_dep, hedley_dep],
extra_files: [cdfpp_headers, cdfpp_extra_files]
)
endif

cdfpp_dep = declare_dependency(include_directories: include_directories('include'),
dependencies: [zlib_dep, hedley_dep])
Expand Down Expand Up @@ -139,13 +139,6 @@ install_headers(
'include/cdfpp/cdf-io/cdf-io-rle.hpp'
], subdir:'cdfpp/cdf-io')

pkg = import('pkgconfig')
pkg.generate(cdfpp_lib,
subdirs : meson.project_name(),
version : meson.project_version(),
name : meson.project_name(),
filebase : meson.project_name(),
description : 'An header only modern C++ CDF library.')

if get_option('with_tests')

Expand Down
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
option('with_tests', type : 'boolean', value : false, description : 'Disable tests build.')
option('show_extra_files', type : 'boolean', value : false, description : 'adds dummy lib to show extra files into an IDE.')
17 changes: 9 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
[build-system]
requires = ["git+https://github.com/jeandet/mesonpep517@windows_fix_dump-pep425tags", "wheel", "ninja>=1.8.2", "meson<=0.61.4"]
build-backend = "mesonpep517.buildapi"
build-backend = 'mesonpy'
requires = ['meson-python', 'numpy']


[tool.mesonpep517.metadata]
[project]
name = "pycdfpp"
description="A modern C++ header only cdf library"
author = "Alexis Jeandet"
author-email = "alexis.jeandet@member.fsf.org"
authors = [{name="Alexis Jeandet", email="alexis.jeandet@member.fsf.org"}]
summary = "A simple to use CDF files reader"
[project]
requires-python=">=3.7"
license = "GNU General Public License v3"
license = {file="COPYING"}
readme = "README.md"
classifiers = [
"Development Status :: 2 - Pre-Alpha",
Expand All @@ -24,5 +22,8 @@ classifiers = [
"Programming Language :: Python :: 3.10",
]
dependencies = ['numpy']
dynamic = [
'version',
]
[project.urls]
homepage = "https://github.com/SciQLop/CDFpp"

0 comments on commit 6140b14

Please sign in to comment.