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

Don't require pyproject.toml when cargo manifest is not specified #806

Merged
merged 2 commits into from
Feb 9, 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
6 changes: 5 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
manylinux: [ 'manylinux2014', 'manylinux_2_24' ]
# manylinux2014 fails with `/lib64/libc.so.6: version `GLIBC_2.18'` not found recently
# could be a upstream Rust issue, disable it for now
#
# manylinux: [ 'manylinux2014', 'manylinux_2_24' ]
manylinux: [ 'manylinux_2_24' ]
container: quay.io/pypa/${{ matrix.manylinux }}_x86_64
steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 2 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

* Don't require `pyproject.toml` when cargo manifest is not specified in [#806](https://github.com/PyO3/maturin/pull/806)

## [0.12.8] - 2022-02-08

* Add missing `--version` flag from clap 3.0 upgrade
Expand Down
25 changes: 14 additions & 11 deletions src/build_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,21 @@ impl BuildOptions {
let current_dir = env::current_dir()
.context("Failed to detect current directory ಠ_ಠ")?
.canonicalize()?;
let pyproject = PyProjectToml::new(&current_dir).context("pyproject.toml is invalid")?;
if let Some(path) = pyproject.manifest_path() {
println!("🔗 Found cargo manifest path in pyproject.toml");
// pyproject.toml must be placed at top directory
let manifest_dir = path
.parent()
.context("missing parent directory")?
.canonicalize()?;
if !manifest_dir.starts_with(&current_dir) {
bail!("Cargo.toml can not be placed outside of the directory containing pyproject.toml");
if current_dir.join("pyproject.toml").is_file() {
let pyproject =
PyProjectToml::new(&current_dir).context("pyproject.toml is invalid")?;
if let Some(path) = pyproject.manifest_path() {
println!("🔗 Found cargo manifest path in pyproject.toml");
// pyproject.toml must be placed at top directory
let manifest_dir = path
.parent()
.context("missing parent directory")?
.canonicalize()?;
if !manifest_dir.starts_with(&current_dir) {
bail!("Cargo.toml can not be placed outside of the directory containing pyproject.toml");
}
return Ok(path.to_path_buf());
}
return Ok(path.to_path_buf());
}
// check Cargo.toml in current directory
let path = PathBuf::from("Cargo.toml");
Expand Down