Skip to content
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 src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ pub enum Command {

#[derive(clap::Args, Debug)]
pub struct Componentize {
/// The name of a Python module containing the app to wrap
/// The name of a Python module containing the app to wrap.
///
/// Note that this should not match (any of) the world name(s) you are targeting since `componentize-py` will
/// generate code using those name(s), and Python doesn't know how to load two top-level modules with the same
/// name.
pub app_name: String,

/// Specify a directory containing the app and/or its dependencies. May be specified more than once.
Expand Down
7 changes: 7 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,13 @@ pub async fn componentize(
.chain(main_world)
.collect::<IndexSet<_>>();

if worlds
.iter()
.any(|&id| app_name == resolve.worlds[id].name.to_snake_case().escape())
{
bail!("App name `{app_name}` conflicts with world name; please rename your application module.");
}

let summary = Summary::try_new(
&resolve,
&worlds,
Expand Down
Loading