More Python quirks

Hal Murray hmurray at megapathdsl.net
Fri Nov 25 05:29:16 UTC 2016


esr at thyrsus.com said:
> You should, at this point, assume that you need to run "waf build" any time
> anything in the Python library changes.  Not the client code, like ntpq, but
> anything in pylib.

This could easily be a wild goose chase, so treat accordingly.

I'm not particularly happy with the waf/Python interactions.  I can't put my 
finger on anything that is obviously wrong, but it doesn't feel right.

Why do I need to run ./waf build to fixup python stuff.  That's not part of 
the normal python work flow.  (aka if I screwed up, others probably will too 
so I think we should fix it if we can)

Why is ntpq copied to build/main/ntpq/ ?
Why aren't the sources from pylib copied to build/main/pylib/ ?
(or rather links back to the source so I don't have to rerun the copy)
I think if the source was available, python would have recompiled things and 
avoided my confusion.

For testing, why do we run ntpq by cd-ing to ntpq rather than cd-ing to 
build/main/ntpq

-------

There is a some coverage of PYTHONPATH in devel/testing.txt

The text is clean, but not satisfying.  I think the problem is that I'm 
missing the big picture.
What is python's overall search strategy? What happens if it finds binaries 
without sources and sources without binaries?

I'm guessing the search strategy is dot, PYTHONPATH, then sys.path, and it 
uses binaries if it finds them without sources and if it find sources without 
binaries, it puts the binaries back in that directory (permissions allowing).
 
How would you find that text if you had a problem but didn't know much about 
python?
You might get there if you followed everything step by step, but nobody does 
that.
A line or two in INSTALL might help.

Is there a section about switching to python in the differences between 
ntpsec and ntp classic?
I think a warning about potential search path quirks would be appropriate.

NEWS has the details.  Do we need a less verbose summary of the changes?
I think README and/or INSTALL need a pointer to the differences.

Does --enable-classic-mode do anything to the python code?  If so, how does 
that work?
(If not, we should probably tweak the text to indicate that it only applies 
to ntpd.)

--------

There are still some waf activity for the python stuff that happens at check 
vs build time and the other way around.
I'll put that in another message.


-- 
These are my opinions.  I hate spam.





More information about the devel mailing list