From c5b084660f226612d73c5b33a24a93e2411587ea Mon Sep 17 00:00:00 2001 From: CTFer Date: Sun, 17 Nov 2024 10:38:45 +0800 Subject: [PATCH 1/4] add __main__.py Since some one like to install packages in portable Python , there would not be a command like `gaps`. Also currently they can not use the gaps as a module, if they use the command `.\python.exe -m gaps` , it will say: `No module named gaps.__main__; 'gaps' is a package and cannot be directly executed` add the `__main__.py` could let them use command as a module. ```SHELL .\python.exe -m gaps [create|run] ... ``` --- gaps/__main__.py | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 gaps/__main__.py diff --git a/gaps/__main__.py b/gaps/__main__.py new file mode 100644 index 0000000..33163dc --- /dev/null +++ b/gaps/__main__.py @@ -0,0 +1,4 @@ +from .cli import * + +if __name__ == '__main__': + cli(); From 9b9d8be4160b94bff013e42b423637e6dc077c21 Mon Sep 17 00:00:00 2001 From: CTFer Date: Mon, 18 Nov 2024 19:00:08 +0800 Subject: [PATCH 2/4] Update __main__.py 1. use double quotes instead of single quotes 2. semicolon removed --- gaps/__main__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gaps/__main__.py b/gaps/__main__.py index 33163dc..4a5f8b7 100644 --- a/gaps/__main__.py +++ b/gaps/__main__.py @@ -1,4 +1,4 @@ from .cli import * -if __name__ == '__main__': - cli(); +if __name__ == "__main__": + cli() From 6edbced3c9321f8203d1cb5050601c71e643623b Mon Sep 17 00:00:00 2001 From: CTFer Date: Thu, 21 Nov 2024 20:29:11 +0800 Subject: [PATCH 3/4] Update __main__.py Replace tabs with spaces. --- gaps/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gaps/__main__.py b/gaps/__main__.py index 4a5f8b7..f9a24df 100644 --- a/gaps/__main__.py +++ b/gaps/__main__.py @@ -1,4 +1,4 @@ from .cli import * if __name__ == "__main__": - cli() + cli() From 05e8f5ff1639d22f1748da4cce09f6f79f819087 Mon Sep 17 00:00:00 2001 From: CTFer Date: Fri, 22 Nov 2024 14:15:28 +0800 Subject: [PATCH 4/4] Update __main__.py Use Try/Catch to import cli module --- gaps/__main__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gaps/__main__.py b/gaps/__main__.py index f9a24df..df40aba 100644 --- a/gaps/__main__.py +++ b/gaps/__main__.py @@ -1,4 +1,10 @@ -from .cli import * +try: + from gaps.cli import * +except: + try: + from .cli import * + except: + from cli import * if __name__ == "__main__": cli()