Python Library Cleanups
Fred Wright
fw at fwright.net
Tue Sep 26 03:26:44 UTC 2017
I finally have the fixes I've been working on related to the Python
library setup ready for publication. The important issues were:
1) Waf misuses get_python_lib() in a way that often gets the wrong result,
with the effect of installing the libraries in a location where Python
doesn't look for them. This led to various inappropriate recommendations
to set PYTHONPATH. PYTHONPATH is a special developer kludge, analogous to
LD_LIBRARY_PATH, which should never be set in normal operation. Code that
depends on setting PYTHONPATH isn't production-ready.
2) The in-tree testing setup wasn't fully functional. In the process of
fixing that, I noticed that it was set up to apply the hacks to the
*source* tree, which is inconsistent with the project's organizational
philosophy of keeping build products out of the source tree. I've
reworked that, and it now works for all Python versions and handles the
tests as well as the clients, but the switch to the build-tree orientation
has operational impact (on developers, not users):
2.1) One now needs to use the build-tree path rather than the source-tree
path to run any given "uninstalled" program. E.g., run
build/main/ntpclients/ntpq instead of ntpclients/ntpq. To defend against
doing this wrong by accident, the source-tree copies no longer have
execute permissions. This should also avoid .pyc/.pyo pollution in the
source tree.
2.2) Any personal scripts and/or symlinks pointing to these programs need
to be updated.
Aside from a couple of things that are unavoidably created in the source
tree (including the build directory itself), there are now only two build
products being created in the source tree:
1) The ntpd/version.h file. This is probably fairly easy to fix, but when
my quickie attempt didn't work I just left it for later. This is the only
remaining use of the 'clean' part of afterparty().
2) The autorevision cache. That whole autorevision thing needs work,
since right now it's not possible to build outside a git repo without
taking extra steps to create and install the cache file. And contrary to
what's implied by the documentation, it's not specifically a
cross-building issue. Either autorevision needs some sort of non-git
fallback (a la GPSD), or there needs to be some better way to populate a
non-git directory for a working build. Anyway, I left that stuff alone
for now.
MR coming.
Fred Wright
More information about the devel
mailing list