Skip to content

Commit bca7cb7

Browse files
committed
Resolve pygame_sdl2 import issue when installing Android SDK
1 parent 26bbca6 commit bca7cb7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/renutil.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,16 @@ pub async fn install(
712712
std::os::unix::fs::symlink(base_path.join("renpy"), base_path.join("rapt/renpy"))?;
713713
}
714714

715+
println!("Patching import issue in android.py");
716+
// it imports pygame_sdl2 but never uses it. it's not in sys.path by default, which makes it annoying to deal with
717+
let interface_path = base_path.join("rapt/android.py");
718+
let content = fs::read_to_string(&interface_path)?;
719+
let lines: Vec<&str> = content
720+
.split('\n')
721+
.filter(|line| !line.contains("import pygame_sdl2"))
722+
.collect();
723+
fs::write(&interface_path, lines.join("\n"))?;
724+
715725
unsafe { env::set_var("RAPT_NO_TERMS", "1") };
716726

717727
let android_py = base_path.join("rapt/android.py");

0 commit comments

Comments
 (0)