Coverage for apio/__main__.py: 71%

10 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2025-11-06 10:20 +0000

1#!venv/bin/python 

2"""Apio starting point.""" 

3 

4import sys 

5 

6 

7def main(): 

8 """Apio starting point.""" 

9 

10 # pylint: disable=import-outside-toplevel 

11 

12 # -- Handle the case in which we run under pyinstaller and the pyinstaller 

13 # -- program was invoked to run the scons subprocess. This case doesn't 

14 # -- happen when running as a standard pip package. 

15 # -- See https://github.com/orgs/pyinstaller/discussions/9023 for details. 

16 if sys.argv[1:3] == ["-m", "SCons"]: 16 ↛ 18line 16 didn't jump to line 18 because the condition on line 16 was never true

17 # -- Drop the "-m SCons" args. 

18 sys.argv[1:] = sys.argv[3:] 

19 # -- We import and initialize scons only when running the scons 

20 # -- subprocess. 

21 from SCons.Script.Main import main as scons_main 

22 

23 # Invoke the scons main function. 

24 scons_main() 

25 

26 # -- Else, this is a normal apio invocation. Call the top level Apio's 

27 # -- Click command. We import apio only in this case. 

28 else: 

29 from apio.commands.apio import apio_top_cli 

30 

31 # -- Due to the Click decorations of apio_top_cli() and the Click 

32 # -- magic, this function is not really invoked but Click dispatches 

33 # -- it to its subcommands that was selected by the user command line. 

34 apio_top_cli() 

35 

36 

37if __name__ == "__main__": 

38 main()