#1970 is presently titled "
update leo/core/leoserver.py from leointeg/leobridgeserver.py"
This project isn't as simple as it may seem. This post describes my plans and my thinking.
The goal
Imo, it is becoming urgent to use Leo's server code in leoInteg. In other words, we want exactly one version of Leo's server.
Again imo, that server should be called leoserver.py, and it should live in leo/core.
As I suggested earlier, the user of leoInteg should only have to point to Leo's leo-editor folder. Once that happens, leoInteg can easily find leo/core/leoserver.py.
BTW, there is an inevitable confusion about the phase "path to the leo-editor folder". Does that path include leo-editor itself, or does the path end with the parent directory of leo-editor? So the label to be used on the button that selects the leo-editor folder is a bit fraught. Happily, behind the scenes the code that sets the setting can ensure that yes, the path does end in /leo-editor. Clear?
The present code in the ekr-server-imports branch
At present, PR #1971 goes considerably farther than the title of #1970 implies. As a result, the diff is long.
Per the title of #1970, the general idea is that leo/core/leoserver.py is closely based on leointeg/leobridgeserver.py. However, leointeg.leo uses an `@clean` tree for leobridgeserver.py, but in leo/core/leoserver.py I definitely want to use `@file`. This change adds a lot of sentinels to the diff. Furthermore, the `@file` node starts with `@first` to get the shebang line at the very start of the file.
My plan
I would like to merge the ekr-server-imports branch into devel in the next day or so. Unless I have made a serious error in the copy/paste process, leoserver.py should be functionally identical to leobridgeserver.py.
As noted in both #1970 and PR #1971, I have also made a few other changes:
- Using __file__, add path to leo-editor folder to sys.path if necessary.
As we have discussed, this new code should allow leointeg to execute leoserver.py
regardless of system settings, and regardless of the paths in python's sys.path array.
- Add leo/core/old_leoserver.py for comparison.
This file will eventually go away, but for now it may be useful.
- Fix some pyflakes complaints by commenting out unused code.
Summary
Right now leoInteg works with leoserver.py in the ekr-server-imports branch.
The diffs for the PR are long because leoserver.py was created from `@file` instead of `@clean`.
Unless there are serious problems with leoserver.py, I would like to merge the ekr-server-imports branch into devel in the next day or three. I would like to make some additional changes to leoserver.py to make it more pythonic or Leonine, but I want to make all such changes as part of a separate issue and PR. That way the diffs will be small and focused.
Once leoserver.py becomes part of Leo's devel branch, I recommend deleting leobridgeserver.py from leoInteg as soon as possible.
Félix, I will wait for your comments before merging ekr-server-imports into devel.
Edward