From: Tomek Mrugalski Date: Fri, 26 Aug 2022 07:48:13 +0000 (+0200) Subject: [#2534] Dynamic python ver detection X-Git-Tag: Kea-2.2.1~43 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b012396a9e3a913202eb878e61fde5c3497d1734;p=thirdparty%2Fkea.git [#2534] Dynamic python ver detection patch by Andrei Pavel --- diff --git a/hammer.py b/hammer.py index 984fbaf8d7..5e0c486998 100755 --- a/hammer.py +++ b/hammer.py @@ -1762,16 +1762,11 @@ def prepare_system_local(features, check_times): packages = ['autoconf', 'automake', 'libtool', 'openssl', 'log4cplus', 'boost-libs', 'wget'] if 'docs' in features: - # FreeBSD 11 and earlier should have python 3.7 - # FreeBSD 12 seems to have python 3.8 - # FreeBSD 13 has python 3.9 - if float(revision.split('.')[0]) < 12.0: - packages.extend(['py37-sphinx', 'py37-sphinx_rtd_theme']) - else: - if revision.startswith(('12')): - packages.extend(['py38-sphinx', 'py38-sphinx_rtd_theme']) - else: - packages.extend(['py39-sphinx', 'py39-sphinx_rtd_theme']) + # Get the python version from the remote repositories. + _, output = execute("pkg search python | grep -Eo '^python-[0-9]+\.[0-9]+' | cut -d '-' -f 2 | tr -d '.'", + capture=True) + pyv = output.strip() + packages.extend([f'py{pyv}-sphinx', f'py{pyv}-sphinx_rtd_theme']) if 'mysql' in features: if revision.startswith(('11', '12')):