From 3ed0dd9b0c2d576d3499605e0d65b3345c538155 Mon Sep 17 00:00:00 2001 From: messense Date: Tue, 15 Mar 2022 19:27:04 +0800 Subject: [PATCH] Change mixed rust/python template project layout --- src/new_project.rs | 4 +++- src/templates/Cargo.toml.j2 | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/new_project.rs b/src/new_project.rs index 6a6ab7d31..534f53644 100644 --- a/src/new_project.rs +++ b/src/new_project.rs @@ -57,7 +57,8 @@ impl<'a> ProjectGenerator<'a> { self.write_project_file(&gh_action_path, "CI.yml")?; if self.mixed { - let py_path = project_path.join(&self.crate_name); + let python_dir = project_path.join("python"); + let py_path = python_dir.join(&self.crate_name); fs::create_dir_all(&py_path)?; self.write_project_file(&py_path, "__init__.py")?; } @@ -73,6 +74,7 @@ impl<'a> ProjectGenerator<'a> { name => self.project_name, crate_name => self.crate_name, bindings => self.bindings, + mixed => self.mixed, version_major => version_major, version_minor => version_minor ))?; diff --git a/src/templates/Cargo.toml.j2 b/src/templates/Cargo.toml.j2 index b4ff99f69..4915dd82d 100644 --- a/src/templates/Cargo.toml.j2 +++ b/src/templates/Cargo.toml.j2 @@ -17,3 +17,7 @@ pyo3 = { version = "0.16.1", features = ["extension-module"] } {%- elif bindings == "rust-cpython" -%} cpython = { version = "0.7.0", features = ["extension-module"] } {%- endif -%} +{% if mixed -%} +[package.metadata.maturin] +python-source = "python" +{%- endif -%}