Skip to content

Commit

Permalink
Merge pull request openwsn-berkeley#290 from chrysn-pull-requests/usa…
Browse files Browse the repository at this point in the history
…ble-sdist

Make sdist packages usable
  • Loading branch information
geonnave authored Jun 23, 2024
2 parents cc43e95 + f2b3130 commit 6af24b7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
19 changes: 18 additions & 1 deletion .github/workflows/python-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches: [main]
tags: 'v*'
workflow_dispatch:
pull_request:

jobs:
build-python-wheels:
Expand Down Expand Up @@ -48,10 +49,26 @@ jobs:
maturin build --sdist --out wheelhouse
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'

- name: Build wheels
# By building from sdist once we ensure that all components needed (see
# the dev-dependencies of lakers-python for an example) are available not
# just in the environment but also inside the sdist, and Cargo can run
# through.
- name: Build wheels from sdist
run: |
mkdir unpacked-source
cd unpacked-source
tar xf ../lakers-python/wheelhouse/lakers_python-*.tar.gz
cd lakers_python-*
maturin build --release --out ../../lakers-python/wheelhouse
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'

# Building from tree most of the time because otherwise the sdist would
# need to be synchronized across all the jobs.
- name: Build wheels from tree
run: |
cd lakers-python
maturin build --release --out wheelhouse
if: matrix.os != 'ubuntu-latest' || matrix.python-version != '3.11'

- uses: actions/upload-artifact@v4
with:
Expand Down
12 changes: 12 additions & 0 deletions lakers-python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ lakers-ead-authz = { path = "../ead/lakers-ead-authz" }
lakers-shared = { path = "../shared", features = ["python-bindings", "quadruple_sizes"] }
lakers-crypto = { path = "../crypto", default-features = false, features = ["rustcrypto"] }

[dev-dependencies]
# We don't need it to build, but it is listed in the manifest Cargo.toml, and
# unless that gets reduced during the Python package building, listing crates
# here is an easy way to ensure that they are present in the source tar ball.
# Their presence is necessary for a build from the source tar ball to not fail at cargo time with
#
# error: failed to load manifest for workspace member `${PWD}/lakers-python`
# [...]
# Caused by:
# failed to read `${PWD}/crypto/lakers-crypto-psa/Cargo.toml`
lakers-crypto-psa = { path = "../crypto/lakers-crypto-psa/" }

[lib]
name = "lakers" # this will be the name of the python package (as in `import lakers`), and it must match the module name in lib.rs
crate-type = ["cdylib"]

0 comments on commit 6af24b7

Please sign in to comment.