diff --git a/Changelog.md b/Changelog.md index 7c64b277a..021f9844e 100644 --- a/Changelog.md +++ b/Changelog.md @@ -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 diff --git a/src/source_distribution.rs b/src/source_distribution.rs index 4e296527f..04b202a69 100644 --- a/src/source_distribution.rs +++ b/src/source_distribution.rs @@ -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() { @@ -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!(