Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add python source files specified in pyproject.toml to sdist #1102

Merged
merged 1 commit into from
Sep 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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