Skip to content

Commit

Permalink
Fix sdist with python-source specified
Browse files Browse the repository at this point in the history
`pyproject.toml` has to be on top level, otherwise pip won't be able to
install from a source distribution.
  • Loading branch information
messense committed Aug 6, 2021
1 parent ca016b7 commit 41a49b6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
10 changes: 5 additions & 5 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ then the project structure would look like this:
my-project
├── Cargo.toml
├── python
   ├── my_project
  │ ├── __init__.py
   │ ├── __init__.py
   │ └── bar.py
│   └── pyproject.toml
── my_project
├── __init__.py
├── __init__.py
└── bar.py
── pyproject.toml
├── Readme.md
└── src
   └── lib.rs
Expand Down
8 changes: 1 addition & 7 deletions src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use anyhow::{bail, Context, Result};
use fs_err as fs;
use regex::Regex;
use serde::{Deserialize, Serialize};
use std::borrow::Cow;
use std::collections::HashMap;
use std::path::{Path, PathBuf};
use std::str;
Expand Down Expand Up @@ -359,12 +358,7 @@ impl Metadata21 {
};

let manifest_path = manifest_path.as_ref();
let py_src = extra_metadata
.python_source
.map_or(Cow::Borrowed(manifest_path), |src| {
Cow::Owned(manifest_path.join(src))
});
metadata.merge_pyproject_toml(&*py_src)?;
metadata.merge_pyproject_toml(manifest_path)?;
Ok(metadata)
}

Expand Down

0 comments on commit 41a49b6

Please sign in to comment.