Only run entrypoint once when running the lightpath command from the cli entrypoint.
This is a workaround, honestly. I'm ok with this not being merged until we figure out exactly what's going on, maybe this is just a me problem
Motivation and Context
GUI was opening twice when running the command lightpath from the cli.
For my own understanding:
The python -m option runs the __main__.py file
This only runs entrypoint() once, as desired.
The entrypoint 'console_scripts': ['lightpath = lightpath.main:entrypoint'] imports and runs lightpath.main.entrypoint.
For some reason this imports __main__.py before running entrypoint, which by all means it shouldn't....
I can't figure out why this is the case, and the structure of our entrypoint matches our other packages. Those other packages don't run __main__.py when using the cli entrypoint.
(pcds-5.4.2)roberttk@psbuild-rhel7-01:~$ lightpath --sim
running file __main__.py, with name: lightpath.__main__
running file main.py, with name: lightpath.main
entrypoint
[2022-08-15 11:16:58] - INFO - Launching LCLS Lightpath ...
<... clip ...>
entrypoint
[2022-08-15 11:17:10] - INFO - Launching LCLS Lightpath ...
(pcds-5.4.2)roberttk@psbuild-rhel7-01:~$ python -m lightpath --sim
running file __main__.py, with name: __main__
running file main.py, with name: lightpath.main
entrypoint
[2022-08-15 11:17:24] - INFO - Launching LCLS Lightpath ...
<... clip ...>
(pcds-5.4.2)roberttk@psbuild-rhel7-01:~$
How Has This Been Tested?
Interactively. Both lightpath and python -m lightpath work
Description
Only run
entrypoint
once when running thelightpath
command from the cli entrypoint.This is a workaround, honestly. I'm ok with this not being merged until we figure out exactly what's going on, maybe this is just a me problem
Motivation and Context
GUI was opening twice when running the command
lightpath
from the cli.For my own understanding:
python -m
option runs the__main__.py
fileentrypoint()
once, as desired.'console_scripts': ['lightpath = lightpath.main:entrypoint']
imports and runslightpath.main.entrypoint
.__main__.py
before runningentrypoint
, which by all means it shouldn't....__main__.py
when using the cli entrypoint.How Has This Been Tested?
Interactively. Both
lightpath
andpython -m lightpath
workWhere Has This Been Documented?
This PR