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

Find python module next to pyproject.toml if pyproject.toml exists #1044

Merged
merged 1 commit into from
Aug 7, 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
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Add Linux sparc64 architecture support in [#1027](https://github.com/PyO3/maturin/pull/1027)
* Add PEP 440 local version identifier support in [#1037](https://github.com/PyO3/maturin/pull/1037)
* Fix inconsistent `Cargo.toml` and `pyproject.toml` path handling in [#1043](https://github.com/PyO3/maturin/pull/1043)
* Find python module next to `pyproject.toml` if `pyproject.toml` exists in [#1044](https://github.com/PyO3/maturin/pull/1044).
It's technically a **breaking change**, but previously it doesn't work properly
if the directory containing `pyproject.toml` isn't recognized as project root.

## [0.13.1] - 2022-07-26

Expand Down
9 changes: 7 additions & 2 deletions src/project_layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl ProjectResolver {
let manifest_dir = manifest_file.parent().unwrap();
let pyproject_toml: Option<PyProjectToml> = if pyproject_file.is_file() {
let pyproject =
PyProjectToml::new(pyproject_file).context("pyproject.toml is invalid")?;
PyProjectToml::new(&pyproject_file).context("pyproject.toml is invalid")?;
pyproject.warn_missing_maturin_version();
pyproject.warn_missing_build_backend();
Some(pyproject)
Expand Down Expand Up @@ -89,8 +89,13 @@ impl ProjectResolver {
let data = pyproject
.and_then(|x| x.data())
.or_else(|| extra_metadata.data.as_ref().map(Path::new));
let project_root = if pyproject_file.is_file() {
pyproject_file.parent().unwrap_or(manifest_dir)
} else {
manifest_dir
};
let project_layout = ProjectLayout::determine(
manifest_dir,
project_root,
extension_name,
extra_metadata.python_source.as_deref(),
data,
Expand Down