An incomplete and simplified version of _PyPathConfig_ComputeSysPath0. We need this to somewhat properly emulate the behaviour of a normal python interpreter when using ya ide venv.
()
| 698 | |
| 699 | |
| 700 | def get_path0(): |
| 701 | """ |
| 702 | An incomplete and simplified version of _PyPathConfig_ComputeSysPath0. |
| 703 | We need this to somewhat properly emulate the behaviour of a normal python interpreter |
| 704 | when using ya ide venv. |
| 705 | |
| 706 | """ |
| 707 | if not sys.argv: |
| 708 | return |
| 709 | argv0 = sys.argv[0] |
| 710 | |
| 711 | have_module_arg = argv0 == '-m' |
| 712 | |
| 713 | if have_module_arg: |
| 714 | return _os.getcwd() |
| 715 | |
| 716 | |
| 717 | if YA_IDE_VENV: |