-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
watcher-py: with meson and cibuildwheel
- Loading branch information
Will
committed
Jul 14, 2024
1 parent
131c03e
commit dc9b159
Showing
10 changed files
with
123 additions
and
106 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,31 @@ | ||
name: Watcher Py Wheels | ||
|
||
on: | ||
push: | ||
branches: [ release, next ] | ||
pull_request: | ||
branches: [ release, next ] | ||
|
||
|
||
jobs: | ||
watcher_py_wheels: | ||
# Ref: https://cibuildwheel.pypa.io/en/stable/setup | ||
strategy: | ||
matrix: | ||
# macos-13 is an intel runner, macos-14 is apple silicon | ||
os: [ ubuntu-latest, windows-latest, macos-13, macos-14 ] | ||
name: Build wheels on ${{matrix.os}} | ||
runs-on: ${{matrix.os}} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: pypa/cibuildwheel@v2.19.2 | ||
env: | ||
MACOSX_DEPLOYMENT_TARGET: "10.14" | ||
with: | ||
package-dir: . | ||
output-dir: wheelhouse | ||
config-file: pyproject.toml | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: cibw-wheels-${{matrix.os}}-${{strategy.job-index}} | ||
path: wheelhouse/*.whl |
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,6 +1,7 @@ | ||
.cache | ||
compile_commands.json | ||
tmp_test_watcher | ||
virtualenv | ||
/out | ||
/result | ||
/watcher | ||
|
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,24 +1,42 @@ | ||
#! /usr/bin/env bash | ||
set -e | ||
[ -d "$(dirname "$0")/out" ] || mkdir "$(dirname "$0")/out" | ||
cd "$(dirname "$0")" | ||
linux-cross-compilation-containers/build-containers.sh | ||
[ -f out/meson.build ] || cp meson.build out | ||
[ -d out/src ] || cp -r src out | ||
[ -d out/include ] || cp -r include out | ||
( | ||
cd out | ||
SRC=$PWD | ||
docker run --platform linux/amd64 --rm -v "$SRC:/src" meson-builder-x86_64-unknown-linux-gnu:latest | ||
docker run --platform linux/arm64 --rm -v "$SRC:/src" meson-builder-aarch64-unknown-linux-gnu:latest | ||
docker run --platform linux/arm/v7 --rm -v "$SRC:/src" meson-builder-armv7-unknown-linux-gnueabihf:latest | ||
) | ||
[ "$(uname)" = Darwin ] && { | ||
[ -d out/x86_64-apple-darwin ] || meson setup --cross-file cross-files/x86_64-apple-darwin.txt out/x86_64-apple-darwin | ||
[ -d out/aarch64-apple-darwin ] || meson setup --cross-file cross-files/aarch64-apple-darwin.txt out/aarch64-apple-darwin | ||
meson compile -C out/x86_64-apple-darwin | ||
meson compile -C out/aarch64-apple-darwin | ||
[ "${1:-}" = --clean ] && { | ||
rm -rf "$(dirname "$0")/out" | ||
exit | ||
} | ||
[ "${1:-}" = --show-artifacts ] && { | ||
for pattern in '*.a' '*.so' '*.dylib' | ||
do find "$(dirname "$0")/out" -type f -name "$pattern" | ||
done | ||
exit | ||
} | ||
[ "${1:---build}" = --build ] && { | ||
[ -d "$(dirname "$0")/out" ] || mkdir "$(dirname "$0")/out" | ||
cd "$(dirname "$0")" | ||
linux-cross-compilation-containers/build-containers.sh | ||
[ -f out/meson.build ] || cp meson.build out | ||
[ -d out/src ] || cp -r src out | ||
[ -d out/include ] || cp -r include out | ||
( | ||
cd out | ||
SRC=$PWD | ||
docker run --platform linux/amd64 --rm -v "$SRC:/src" meson-builder-x86_64-unknown-linux-gnu:latest | ||
docker run --platform linux/arm64 --rm -v "$SRC:/src" meson-builder-aarch64-unknown-linux-gnu:latest | ||
docker run --platform linux/arm/v7 --rm -v "$SRC:/src" meson-builder-armv7-unknown-linux-gnueabihf:latest | ||
) | ||
[ "$(uname)" = Darwin ] && { | ||
[ -d out/x86_64-apple-darwin ] || meson setup --cross-file cross-files/x86_64-apple-darwin.txt out/x86_64-apple-darwin | ||
[ -d out/aarch64-apple-darwin ] || meson setup --cross-file cross-files/aarch64-apple-darwin.txt out/aarch64-apple-darwin | ||
meson compile -C out/x86_64-apple-darwin | ||
meson compile -C out/aarch64-apple-darwin | ||
} | ||
echo '-------- Artifacts --------' | ||
for pattern in '*.a' '*.so' '*.dylib' | ||
do find out -type f -name "$pattern" -exec file {} \; | ||
done | ||
echo '~~~~~~~~~~~~~~~~~~~~~~~~~~~' | ||
for pattern in '*.a' '*.so' '*.dylib' | ||
do find out -type f -name "$pattern" | ||
done | ||
echo '---------------------------' | ||
} | ||
for pattern in '*.a' '*.so' '*.dylib' | ||
do find out -type f -name "$pattern" -exec file {} \; | ||
done |
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,8 @@ | ||
project( | ||
'watcher', | ||
['cpp', 'c'], | ||
version : '0.12.0', # hook: tool/release | ||
default_options : ['c_std=c99', 'cpp_std=c++20'], | ||
) | ||
subdir('libcwatcher') | ||
subdir('watcher-py') |
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,20 @@ | ||
[build-system] | ||
build-backend = "mesonpy" | ||
requires = ["meson >= 1.0.0", "meson-python >= 0.14.0"] | ||
|
||
[project] | ||
name = "watcher" | ||
version = "0.12.0" | ||
authors = [{name = "Will"}] | ||
homepage = "https://github.com/e-dant/watcher" | ||
description = "Filesystem watcher. Works anywhere. Simple, efficient, and friendly." | ||
license.text = "MIT" | ||
keywords = [ "watcher", "filesystem", "events", "async" ] | ||
packages = [{include = "watcher"}] | ||
|
||
[tool.cibuildwheel] | ||
free-threaded-support = true | ||
manylinux-x86_64-image = "manylinux2014" | ||
manylinux-i686-image = "manylinux2014" | ||
manylinux-pypy_x86_64-image = "manylinux2014" | ||
manylinux-pypy_i686-image = "manylinux2014" |
This file was deleted.
Oops, something went wrong.
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,2 @@ | ||
py = import('python').find_installation() | ||
py.install_sources(['watcher/__init__.py', 'watcher/watcher.py']) |
This file was deleted.
Oops, something went wrong.
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