Hi,
It is now possible to ask `debhelper` about the highest stable compat
version via the `dh_assistant supported-compat-levels` command.
I think it would make sense for `dh-make` to use this command as a
suggestion about which compat level to use. An example could be:
``python
import subprocess
_HIGHEST_COMPAT_LEVEL = 13
def extract_dh_compat_level() -> int:
try:
output = subprocess.check_output(
["dh_assistant", "supported-compat-levels"],
stderr=subprocess.DEVNULL,
)
except (FileNotFoundError, subprocess.CalledProcessError) as e:
return _HIGHEST_COMPAT_LEVEL
else:
data = json.loads(output)
compat_level = data.get("HIGHEST_STABLE_COMPAT_LEVEL")
if compat_level is None \
or int(compat_level) < _HIGHEST_COMPAT_LEVEL:
return _HIGHEST_COMPAT_LEVEL
return int(compat_level)
```
(note: written by hand directly in the email. Apologies for any typos)
The example code will automatically pick the highest known debhelper
compat level provided by either `dh_assistant` or `dh_make`, where the
two disagree. They might when running `dh_make` on a stable where
`dh_assistant` does not exist and even in the future for bleeding edge
stuff.
Anyhow, just a suggestion if you want `dh_make` to automatically pick up
the latest compat level when it is available on the system that
`dh_make` is run on. Arguments can be had for both the current behavior
and the suggested behavior; it is really a matter of a preference how
`dh_make` should work. Please see this email a heads up that the
functionality exist and for you to decide which behavior you want (if
you have not already decided long ago).
Best regards,
Niels