-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow for building wheels (#67)
- Loading branch information
Showing
6 changed files
with
122 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: wheel | ||
|
||
on: [push, workflow_dispatch] | ||
|
||
jobs: | ||
sdist: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Reorganize repository | ||
run: | | ||
git config user.email "" | ||
git config user.name "dummy" | ||
git subtree add --prefix python/subprojects/minpack . HEAD | ||
git mv python/{mesonpep517,pyproject}.toml | ||
git commit -m "Python dist" | ||
- run: | | ||
pipx run build . --sdist | ||
working-directory: python | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: minpack-python-sdist | ||
path: python/dist/*.tar.gz | ||
retention-days: 5 | ||
|
||
manylinux: | ||
needs: | ||
- sdist | ||
runs-on: ubuntu-latest | ||
container: condaforge/linux-anvil-cos7-x86_64 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python: ['3.7', '3.8', '3.9', '3.10'] | ||
|
||
defaults: | ||
run: | ||
shell: ${{ matrix.shell || 'bash -l {0}' }} | ||
|
||
steps: | ||
- name: Create environment | ||
run: >- | ||
mamba create -n wheel | ||
--yes | ||
c-compiler | ||
fortran-compiler | ||
python=${{ matrix.python }} | ||
auditwheel | ||
git | ||
python | ||
pip | ||
python-build | ||
pkgconfig | ||
patchelf | ||
cffi | ||
numpy | ||
meson | ||
unzip | ||
wheel | ||
- name: Download sdist | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: minpack-python-sdist | ||
- name: Build wheel | ||
run: | | ||
conda activate wheel | ||
set -ex | ||
tar xvf minpack-*.tar.gz | ||
python -m build minpack-*/ --wheel | ||
auditwheel show minpack-*/dist/*.whl | ||
auditwheel repair -w minpack-*/dist minpack-*/dist/*.whl --plat ${{ env.plat }} | ||
rm minpack-*/dist/*-linux_x86_64.whl | ||
env: | ||
plat: manylinux${{ matrix.python == '3.6' && '2010' || '_2_12' }}_x86_64 | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: minpack-python-${{ matrix.python }} | ||
path: minpack-*/dist/*.whl | ||
retention-days: 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "minpack.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,24 @@ | ||
project( | ||
'minpack', | ||
'c', | ||
meson_version: '>=0.53', | ||
version: '2.0.0', | ||
meson_version: '>=0.55', | ||
default_options: [ | ||
'buildtype=debugoptimized', | ||
], | ||
) | ||
install = true | ||
|
||
minpack_dep = dependency('minpack', version: '>=2.0.0') | ||
minpack_header = files('../include/minpack.h') | ||
minpack_dep = dependency( | ||
meson.project_name(), | ||
version: '>=@0@'.format(meson.project_version()), | ||
fallback: [meson.project_name(), '@0@_dep'.format(meson.project_name())], | ||
default_options: [ | ||
'default_library=static', | ||
'api=true', | ||
'python=false', | ||
], | ||
) | ||
minpack_header = files('include'/'_minpack.h') | ||
|
||
subdir('minpack') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[build-system] | ||
requires = ["meson-python", "cffi"] | ||
build-backend = "mesonpy" | ||
|
||
[project] | ||
name = "minpack" | ||
version = "2.0.0" | ||
description = "Minpack includes software for solving nonlinear equations and nonlinear least squares problems" | ||
readme = "README.rst" | ||
urls.repository = "https://github.com/fortran-lang/minpack" | ||
dependencies = [ | ||
"cffi", | ||
"numpy", | ||
] | ||
requires-python = ">=3.6" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,8 +13,19 @@ python_dep = python.dependency(required: true) | |
# Python's CFFI is horrible in working with preprocessor statements, | ||
# therefore, we have to preprocess the header before passing it to the ffibuilder | ||
minpack_pp = configure_file( | ||
command: [cc, '-DMINPACK_CFFI=1', '-E', '@INPUT@'], | ||
input: minpack_header[0], | ||
command: [ | ||
cc, | ||
'-I@0@'.format( | ||
minpack_dep.get_variable( | ||
pkgconfig: 'includedir', | ||
internal: 'includedir', | ||
).split().get(0) | ||
), | ||
'-DMINPACK_CFFI=1', | ||
'-E', | ||
'@INPUT@', | ||
], | ||
input: minpack_header, | ||
output: '@[email protected]'.format(ext_module), | ||
capture: true, | ||
) | ||
|