Skip to content

Commit

Permalink
Add python source files specified in pyproject.toml to sdist
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed Sep 12, 2022
1 parent 61ae7a9 commit 0e26e49
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Fix sdist when `pyproject.toml` isn't in the same dir of `Cargo.toml` in [#1099](https://github.com/PyO3/maturin/pull/1099)
* Change readme and license paths in `pyproject.toml` to be relative to `pyproject.toml` in [#1100](https://github.com/PyO3/maturin/pull/1100)
It's technically a **breaking change**, but previously it doesn't work properly.
* Add python source files specified in pyproject.toml to sdist in [#1102](https://github.com/PyO3/maturin/pull/1102)

## [0.13.2] - 2022-08-14

Expand Down
9 changes: 8 additions & 1 deletion src/source_distribution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ fn add_crate_to_source_distribution(
PathBuf::from("pyproject.toml"),
pyproject_toml_path.to_path_buf(),
));
// Add readme and license files
// Add readme, license and python source files
if let Some(project) = pyproject.project.as_ref() {
if let Some(pyproject_toml::ReadMe::RelativePath(readme)) = project.readme.as_ref()
{
Expand All @@ -215,6 +215,13 @@ fn add_crate_to_source_distribution(
{
target_source.push((PathBuf::from(license), pyproject_dir.join(license)));
}
if let Some(python_source) = pyproject.python_source() {
for entry in ignore::Walk::new(pyproject_dir.join(python_source)) {
let path = entry?.into_path();
let relative_path = path.strip_prefix(&pyproject_dir)?;
target_source.push((relative_path.to_path_buf(), path));
}
}
}
} else {
bail!(
Expand Down

0 comments on commit 0e26e49

Please sign in to comment.