Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BLD Run build/post script inside the unpacked wheel directory #4481

Merged
merged 4 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 3 additions & 4 deletions docs/development/meta-yaml.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,9 @@ is the source directory.

### `build/post`

Shell commands to run after building the library. This script is run by `bash`
in the directory where `meta.yaml` file resides. The `${PKG_BUILD_DIR}/dist`
will contain the built wheel unpacked with `python -m wheel unpack`
so it's possible to manually add, delete, change, move files etc.
Shell commands to run after building the package. This command runs
in the directory which contains the built wheel unpacked with
`python -m wheel unpack`. So it's possible to manually add, delete, change, move files etc.
See the [setuptools meta.yaml](https://github.com/pyodide/pyodide/
blob/main/packages/setuptools/meta.yaml)
for an example of the usage of this key.
Expand Down
1 change: 0 additions & 1 deletion packages/matplotlib/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ build:
-fexceptions
script: export SETUPTOOLS_SCM_PRETEND_VERSION=$PKG_VERSION
post: |
cd $WHEELDIR
rm -rf matplotlib/backends/qt_editor
rm -rf matplotlib/backends/web_backend
rm -rf sphinxext
Expand Down
1 change: 0 additions & 1 deletion packages/numpy/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ build:
# numpy creates numpy/distutils/__pycache__ directory during the build.
# It breaks our test because there is a .pyc in the directory.
post: |
cd $WHEELDIR
rm -rf numpy/distutils/__pycache__
cflags: |
-Wno-return-type
Expand Down
4 changes: 2 additions & 2 deletions packages/rebound/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ build:
post: |
mkdir -p $WASM_LIBRARY_DIR/include/rebound/
mkdir -p $WASM_LIBRARY_DIR/lib/
cp $WHEELDIR/rebound/*.h $WASM_LIBRARY_DIR/include/rebound/
cp $WHEELDIR/librebound.cpython-*.so $WASM_LIBRARY_DIR/lib/
cp rebound/*.h $WASM_LIBRARY_DIR/include/rebound/
cp librebound.cpython-*.so $WASM_LIBRARY_DIR/lib/

source:
url: https://files.pythonhosted.org/packages/5c/66/7564ac591bb088d7f35a59d560b5c26426bb8ef5415522232819fe11c45a/rebound-3.24.2.tar.gz
Expand Down
2 changes: 1 addition & 1 deletion packages/setuptools/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ source:
sha256: 3d8083eed2d13afc9426f227b24fd1659489ec107c0e86cec2ffdde5c92e790b
build:
post: |
find $WHEELDIR -name '*.exe' -delete
find . -name '*.exe' -delete
requirements:
run:
- pyparsing
Expand Down
7 changes: 3 additions & 4 deletions pyodide-build/pyodide_build/buildpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,9 @@ def _package_wheel(
# update so abi tags after build is complete but before running post script
# to maximize sanity.
replace_so_abi_tags(wheel_dir)

bash_runner.env.update({"WHEELDIR": str(wheel_dir)})

bash_runner.run(self.build_metadata.post, script_name="post script")
bash_runner.run(
self.build_metadata.post, script_name="post script", cwd=wheel_dir
)

if self.build_metadata.vendor_sharedlib:
lib_dir = Path(get_build_flag("WASM_LIBRARY_DIR"))
Expand Down