Skip to content

Commit

Permalink
Merge pull request #855 from messense/mixed-project-layout
Browse files Browse the repository at this point in the history
Change mixed rust/python template project layout
  • Loading branch information
messense authored Mar 21, 2022
2 parents be6c52b + 3ed0dd9 commit a6e8798
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/new_project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")?;
}
Expand All @@ -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
))?;
Expand Down
4 changes: 4 additions & 0 deletions src/templates/Cargo.toml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 -%}

0 comments on commit a6e8798

Please sign in to comment.