Skip to content

Commit

Permalink
Fix source distribution building with manifest path option
Browse files Browse the repository at this point in the history
  • Loading branch information
konstin committed Jul 20, 2019
1 parent 4087a4b commit 11c72ce
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/source_distribution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@ pub fn source_distribution(
.map(Path::new)
.collect();

let target_source: Vec<(&Path, &Path)> = file_list
let manifest_dir = manifest_path.as_ref().parent().unwrap();

let target_source: Vec<(PathBuf, PathBuf)> = file_list
.iter()
.map(|relative_to_cwd| {
let relative_to_project_root = relative_to_cwd
.strip_prefix(manifest_path.as_ref().parent().unwrap())
.unwrap_or(relative_to_cwd);
(relative_to_project_root, *relative_to_cwd)
.map(|relative_to_manifests| {
let relative_to_cwd = manifest_dir.join(relative_to_manifests);
(relative_to_manifests.to_path_buf(), relative_to_cwd)
})
.collect();

if !target_source
.iter()
.any(|(target, _)| target == &Path::new("pyproject.toml"))
.any(|(target, _)| target == Path::new("pyproject.toml"))
{
bail!(
"pyproject.toml was not included by `cargo package`. \
Expand Down

0 comments on commit 11c72ce

Please sign in to comment.