From 87abfe89007f68dd480826c2fff1e7472960ac36 Mon Sep 17 00:00:00 2001 From: Abdelrahman Said Date: Sun, 2 Mar 2025 11:58:25 +0000 Subject: [PATCH] Restructure to keep __main__ free to be used when using codegen as part of another project --- codegen/__main__.py | 8 ++++---- codegen/{codegen.py => codegen_example.py} | 0 codegen/dev_main.py | 6 ++++++ run | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) rename codegen/{codegen.py => codegen_example.py} (100%) create mode 100644 codegen/dev_main.py diff --git a/codegen/__main__.py b/codegen/__main__.py index fae93c7..cd9ac48 100644 --- a/codegen/__main__.py +++ b/codegen/__main__.py @@ -1,6 +1,6 @@ -from .codegen import test_str8, test_doubly_linked_list, test_typed_array +def main(): + pass + if __name__ == "__main__": - test_str8() - test_typed_array() - test_doubly_linked_list() + main() diff --git a/codegen/codegen.py b/codegen/codegen_example.py similarity index 100% rename from codegen/codegen.py rename to codegen/codegen_example.py diff --git a/codegen/dev_main.py b/codegen/dev_main.py new file mode 100644 index 0000000..d1078da --- /dev/null +++ b/codegen/dev_main.py @@ -0,0 +1,6 @@ +from .codegen_example import test_str8, test_doubly_linked_list, test_typed_array + +if __name__ == "__main__": + test_str8() + test_typed_array() + test_doubly_linked_list() diff --git a/run b/run index 6d8984c..19e8e9d 100755 --- a/run +++ b/run @@ -1,3 +1,3 @@ #!/bin/bash -python3 -m codegen +python3 -m codegen.dev_main