Skip to content

Commit

Permalink
Merge pull request #1441 from messense/fix-sdist-locked
Browse files Browse the repository at this point in the history
Keep `dev-dependencies` in sdist when there are no path dependencies
  • Loading branch information
messense authored Jan 31, 2023
2 parents e484bfc + 61ff70e commit e134edf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,10 @@ jobs:
test-bootstrap:
name: Test Bootstrap
if: github.event_name != 'pull_request'
runs-on: ${{ matrix.os }}
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
strategy:
fail-fast: ${{ !contains(github.event.pull_request.labels.*.name, 'CI-no-fail-fast') }}
matrix:
Expand All @@ -440,11 +442,11 @@ jobs:
- uses: dtolnay/rust-toolchain@beta
if: steps.changes.outputs.changed == 'true'
# Caching
- name: Cache cargo build
- name: Sccache Setup
if: steps.changes.outputs.changed == 'true'
uses: Swatinem/rust-cache@v2
uses: Xuanwo/sccache-action@c94e27bef21ab3fb4a5152c8a878c53262b4abb0
with:
shared-key: maturin-build
version: "v0.4.0-pre.6"
- uses: actions/setup-python@v4
if: steps.changes.outputs.changed == 'true'
with:
Expand All @@ -453,9 +455,8 @@ jobs:
shell: bash
run: |
set -ex
pip install build
python3 -m build --wheel -o dist
pip install dist/maturin*.whl
cargo run sdist -o dist
pip install -v dist/maturin-*.tar.gz
if: steps.changes.outputs.changed == 'true'
- run: maturin --version
if: steps.changes.outputs.changed == 'true'
Expand Down
6 changes: 4 additions & 2 deletions src/source_distribution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ fn rewrite_cargo_toml(
// ^^^^^^^^^^^^^ dep_name
for dep_category in ["dependencies", "dev-dependencies", "build-dependencies"] {
if let Some(table) = data.get_mut(dep_category).and_then(|x| x.as_table_mut()) {
if dep_category == "dev-dependencies" {
// Remove dev-dependencies since building from sdist doesn't need them
if dep_category == "dev-dependencies" && !known_path_deps.is_empty() {
// Remove dev-dependencies since building from sdist doesn't need them,
// Keep it when there are no path dependencies to support building from
// sdist with `--locked`/`--frozen`.
data.remove(dep_category);
rewritten = true;
continue;
Expand Down

0 comments on commit e134edf

Please sign in to comment.