Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1948397 - gpgme fails to build with Python 3.10: configure: error: cannot import Python module "distutils".
Summary: gpgme fails to build with Python 3.10: configure: error: cannot import Python...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: gpgme
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Igor Raits
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.10
TreeView+ depends on / blocked
 
Reported: 2021-04-12 06:48 UTC by Tomáš Hrnčiar
Modified: 2021-06-14 10:41 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-06-14 10:38:30 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2021-04-12 06:48:44 UTC
gpgme fails to build with Python 3.10.0a7.

configure: error: cannot import Python module "distutils".
Please check your Python installation. The error was:
<string>:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives

bpo-41282: Deprecate distutils in documentation and add warning on import.
https://bugs.python.org/issue41282
https://www.python.org/dev/peps/pep-0632/

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.10/fedora-rawhide-x86_64/02124459-gpgme/

For all our attempts to build gpgme with Python 3.10, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/package/gpgme/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.10:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/

Let us know here if you have any questions.

Python 3.10 will be included in Fedora 35. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.10.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Miro Hrončok 2021-04-12 07:00:54 UTC
This is needed for dnf, bumping severity and ccing packaging-team-maint@redhat

Comment 2 Miro Hrončok 2021-04-12 15:46:44 UTC
m4/ax_python_devel.m4 has:

	#
	# Check if you have distutils, else fail
	#
	AC_MSG_CHECKING([for the distutils Python package])
	ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`
	if test $? -eq 0; then
		AC_MSG_RESULT([yes])
	else
		AC_MSG_RESULT([no])
		AC_MSG_ERROR([cannot import Python module "distutils".
Please check your Python installation. The error was:
$ac_distutils_result])
		PYTHON_VERSION=""
	fi

I read that as "if the command exited with 0, it's all good" -- and the command exits with 0 even in Python 3.10.

However, configure has:

	#
	# Check if you have distutils, else fail
	#
	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the distutils Python package" >&5
$as_echo_n "checking for the distutils Python package... " >&6; }
	ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`
	if test -z "$ac_distutils_result"; then
		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
	else
		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
		as_fn_error $? "cannot import Python module \"distutils\".
Please check your Python installation. The error was:
$ac_distutils_result" "$LINENO" 5
		PYTHON_VERSION=""
	fi

Which I read as "if the command had empty (stdout+stderr), it's all good"  -- an the command does have the warning on stdout, so it is not OK.

My autotools/m4 skills are pretty much non-existent. I have no idea why the first logic (that seems correct) gets translated to the second (broken) logic.

Comment 3 Miro Hrončok 2021-04-12 15:51:30 UTC
OK, when I run ./autogen.sh, configure is fixed. However, the spec file has:

# People neeed to learn that you can't run autogen.sh anymore
#./autogen.sh

The commit says:

    Do not run autogen.sh
    
    Otherwise, VERSION is set to 1.13.1-unknown which breaks in multiple
    places.

https://src.fedoraproject.org/rpms/gpgme/c/ad98c12a55f90c6120d0ebb2a43914e1aaa517cb?branch=rawhide


How do we fix this?

Comment 4 Miro Hrončok 2021-04-12 15:56:19 UTC
This has been fixed upstream autotools by Igor in m4/ax_python_devel.m4: http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=commit;h=883a2abd5a

Comment 5 Miro Hrončok 2021-04-12 16:13:07 UTC
OK, I've run autogen.sh locally and cherry-picked the changes we need:

https://src.fedoraproject.org/rpms/gpgme/pull-request/7

Comment 6 Miro Hrončok 2021-06-04 20:14:20 UTC
This is a mass-posted update. Sorry if it is not 100% accurate to this bugzilla.


The Python 3.10 rebuild is in progress in a Koji side tag. If you manage to fix the problem, please commit the fix in the rawhide branch, but don't build the package in regular rawhide.

You can either build the package in the side tag, with:

    $ fedpkg build --target=f35-python

Or you can the build and we will eventually build it for you.

Note that the rebuild is still in progress, so not all (build) dependencies of this package might be available right away.

Thanks.

See also https://fedoraproject.org/wiki/Changes/Python3.10

If you have general questions about the rebuild, please use this mailing list thread: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/G47SGOYIQLRDTWGOSLSWERZSSHXDEDH5/

Comment 7 Miro Hrončok 2021-06-07 22:58:59 UTC
The f35-python side tag has been merged to Rawhide. From now on, build as you would normally build.

Comment 8 Miro Hrončok 2021-06-14 10:38:30 UTC
This package was successfully rebuilt with Python 3.10.

If you need this bugzilla open for tracking purposes, sorry for the automatic closing: feel free to reopen it.

Comment 9 Miro Hrončok 2021-06-14 10:41:19 UTC
This package was successfully rebuilt with Python 3.10.

If you need this bugzilla open for tracking purposes, sorry for the automatic closing: feel free to reopen it.


Note You need to log in before you can comment on or make changes to this bug.