Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
dalcinl committed Nov 28, 2024
1 parent f4ad157 commit 73bb868
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/cd-wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ jobs:
CIBW_ARCHS: "${{ matrix.arch }}"
CIBW_BEFORE_ALL: >-
bash {project}/cibw-build-mpi.sh
CIBW_BEFORE_BUILD: >-
bash {project}/cibw-patch-cmd.sh
CIBW_TEST_COMMAND: >-
bash {project}/cibw-check-mpi.sh
CIBW_ENVIRONMENT_PASS: >-
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ build:
lint:
codespell *.sh */*.py
shellcheck *.sh
ruff check -qn package/*.py
ruff check -qn */*.py
yamllint .github/

clean:
Expand Down
15 changes: 15 additions & 0 deletions cibw-patch-cmd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -euo pipefail

case "$(uname)" in
Linux) toolname=auditwheel;;
Darwin) toolname=delocate-wheel;;
esac

topdir=$(cd "$(dirname -- "$0")" && pwd -P)
toolpatch="$topdir/patches/$toolname.py"
test -f "$toolpatch" || exit 0

filename=$(command -v "$toolname")
shebang=$(head -n 1 "$filename")
sed "1 s|^.*$|$shebang|" "$toolpatch" > "$filename"
44 changes: 44 additions & 0 deletions patches/auditwheel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env python

#
# https://github.com/pypa/auditwheel/pull/517
#

import os
import sys
from auditwheel.main import main

def walk(topdir, *args, **kwargs):
topdir = os.path.normpath(topdir)
for dirpath, dirnames, filenames in os_walk(topdir, *args, **kwargs):
# sort list of dirnames in-place such that `os.walk`
# will recurse into subdirectories in reproducible order
dirnames.sort()
# recurse into any top-level .dist-info subdirectory last
if dirpath == topdir:
subdirs = []
dist_info = []
for dir in dirnames:
if dir.endswith(".dist-info"):
dist_info.append(dir)
else:
subdirs.append(dir)
dirnames[:] = subdirs
dirnames.extend(dist_info)
del dist_info
# sort list of filenames for iteration in reproducible order
filenames.sort()
# list any dist-info/RECORD file last
if dirpath.endswith(".dist-info") and os.path.dirname(dirpath) == topdir:
if "RECORD" in filenames:
filenames.remove("RECORD")
filenames.append("RECORD")
yield dirpath, dirnames, filenames


os_walk = os.walk
os.walk = walk


if __name__ == "__main__":
sys.exit(main())
1 change: 1 addition & 0 deletions wheel-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export CIBW_BUILD='cp313-*'
export CIBW_SKIP='*musllinux*'
export CIBW_ARCHS=$ARCHLIST
export CIBW_BEFORE_ALL='bash {project}/cibw-build-mpi.sh'
export CIBW_BEFORE_BUILD='bash {project}/cibw-patch-cmd.sh'
export CIBW_TEST_COMMAND='bash {project}/cibw-check-mpi.sh'
export CIBW_ENVIRONMENT_PASS='MPINAME RELEASE SOURCE WORKDIR DESTDIR'
export CIBW_REPAIR_WHEEL_COMMAND_MACOS='delocate-wheel --ignore-missing-dependencies --exclude libmpi --exclude libpmpi --require-archs {delocate_archs} -w {dest_dir} -v {wheel}'
Expand Down

0 comments on commit 73bb868

Please sign in to comment.