Allow configuring the Python interpreter - #757
Conversation
The Python helper scripts (daps-xmlwellformed, getentityname.py and validate-tables.py) are currently always invoked directly, so they run with the interpreter from their shebang line. That interpreter needs the lxml module, which is not necessarily the case for the system Python. Add a PYTHON config key that selects the interpreter used for these scripts. The default is empty, in which case the scripts are invoked directly as before, so the behaviour is unchanged for existing installations and for packages that pin the shebang line. PYTHON is part of VARLIST, so it uses the regular config precedence and is exported to the makefiles like the other keys.
|
Thanks a lot Lukas! I am not sure what to make of this--it is unobtrusive, but somewhat "hackish". @tomschr What is your take her? BTW: The fact that environment variables are largely ignored is on purpose, Also somewhat hackish, I probably should re-visit this. |
|
I was also unsure, so I asked Gemini and let them review this PR. Here is what it said:
|
In the end the packager will always have to make changes to the software to adapt it to the particular system but this makes it easier. What exactly do you consider hackish? I can try to fix it if needed. |
The assembly resource validation rule in make/assembly2db.mk still invoked daps-xmlwellformed directly, bypassing the PYTHON config key introduced for the other Python helper script call sites. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Hi, this PR make it possible to set the Python interpreter using
~/.config/daps/dapsrcor in DC file. Environment variable is not respected which seems to be true for all DAPS configuration options for some reason.I did not add
--pythonor any similar command-line arguments.This makes it easier to package for systems like NixOS, or to make it easy to use different than system Python in case something breaks (case in point: Tumbleweed recently removed the
python311-lxmlpackage, breaking DAPS, see https://suse.slack.com/archives/C02DEAP3U5P/p1788274848540109).I tested building on Tumbleweed and NixOS. There's a package using this change in https://build.suse.de/package/show/home:LKucharczyk:branches:Documentation:Tools/daps but currently blocked.