Re: [PATCH] configure: check explicitely for python dev (include) files

Subject: Re: [PATCH] configure: check explicitely for python dev (include) files

Date: Fri, 08 Oct 2021 22:22:07 +0300

To: David Bremner, notmuch@notmuchmail.org

Cc:

From: Tomi Ollila


On Thu, Oct 07 2021, David Bremner wrote:

> As discussed at [1] we have received reports that the implicit check
> using cffi.FFI().verify() is not reliable in all environments. Since
> we already use pkg-config, and the python dev package should include a
> .pc file [2], add an extra check using pkg-config.  On at least
> Debian, we have to know which version of python dev files with are
> looking for, so calculate that first.
>
> [1]: id:87im1g35ey.fsf@tethera.netid:87im1g35ey.fsf@tethera.net,
> [2]: checked on Debian and Fedora
> ---
>  configure | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/configure b/configure
> index 4262d122..fc9512f9 100755
> --- a/configure
> +++ b/configure
> @@ -777,7 +777,23 @@ fi
>  
>  have_python3_cffi=0
>  have_python3_pytest=0

Works and look good (but some style mismatches) -- but move the whole added
block before the 2  variables set abobe to zero -- those does not need to
be defined before the code below is executed and it is more consistent that
way... 

> +have_python3_dev=0
>  if [ $have_python3 -eq 1 ]; then
> +    printf "Checking for python3 version ..."
 ----------- extra space here -------------^
> +    python3_version=$("$python" -c 'import sysconfig; print(sysconfig.get_python_version());')
> +    printf "(%s)\n" $python3_version
> +
> +    printf "Checking for python $python3_version development files..."
> +    if pkg-config --exists "python-$python3_version"; then
> +	have_python3_dev=1
> +	printf "Yes.\n"
> +    else
> +	have_python3_dev=0
> +        printf "No (will not install CFFI-based python bindings).\n"
--- tabs vs spaces difference above (use only spaces above for local consistency) ---
> +    fi
> +fi

...i.e. the lines 'have_python3_cffi=0' and 'have_python3_pytest=0' to appear here

> +
> +if [ $have_python3_dev -eq 1 ]; then
>      printf "Checking for python3 cffi and setuptools... "
>      if "$python" -c 'import cffi,setuptools; cffi.FFI().verify()' >/dev/null 2>&1; then
>          printf "Yes.\n"
> -- 
> 2.33.0


Tomi
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: