Bug 1789151

Summary: python-sphinx-testing fails to build with Python 3.9: invalid open() mode U
Product: [Fedora] Fedora Reporter: Charalampos Stratakis <cstratak>
Component: python-sphinx-testingAssignee: Jerry James <loganjerry>
Status: CLOSED DEFERRED QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: cstratak, loganjerry, mhroncok, mplch
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-05 23:20:52 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1785415    

Description Charalampos Stratakis 2020-01-08 21:42:07 UTC
python-sphinx-testing fails to build with Python 3.9.0a2.

This seems to be due to using 'U' mode in the open() function which was removed in Python 3.9

See: https://bugs.python.org/issue37330

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.9/fedora-rawhide-x86_64/01141794-python-sphinx-testing/

For all our attempts to build python-sphinx-testing with Python 3.9, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.9/package/python-sphinx-testing/

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.9:
https://copr.fedorainfracloud.org/coprs/g/python/python3.9/

Let us know here if you have any questions.

Python 3.9 will be included in Fedora 33, but the initial bootstrapping has already started.
A build failure this early in the bootstrap sequence blocks us very much.

Comment 1 Charalampos Stratakis 2020-01-08 21:52:12 UTC
This can be fixed with:

diff --git a/src/sphinx_testing/path.py b/src/sphinx_testing/path.py
index 60caf35..9e16a09 100644
--- a/src/sphinx_testing/path.py
+++ b/src/sphinx_testing/path.py
@@ -155,7 +155,7 @@ class path(text_type):
         """
         Returns the text in the file.
         """
-        f = open(self, mode='U', **kwargs)
+        f = open(self, **kwargs)
         try:
             return f.read()
         finally:

Comment 2 Jerry James 2020-01-09 03:26:02 UTC
According to upstream, sphinx-testing is deprecated in favor of sphinx.testing shipped with sphinx itself.  I'm going to apply the patch from comment 1 for now to unblock the rebuild effort, but we need to start hunting down users of this package and switching them over to sphinx.testing.

Comment 3 Jerry James 2020-01-09 03:40:29 UTC
Patched version built in Rawhide.  I'm going to leave this open for now to remind myself to figure out how to port all users from this package to sphinx.testing.

Comment 4 Miro Hrončok 2020-01-09 07:12:33 UTC
Just:

python-sphinx-removed-in-0:0.2.1-1.fc32.src
python-sphinxcontrib-bibtex-0:1.0.0-1.fc32.src

Comment 5 Jerry James 2020-01-09 15:21:54 UTC
And, sadly, one I just barely added to Fedora: python-sphinx-math-dollar.  Okay, I will try to get them all ported over and then retire python-sphinx-testing.

Comment 6 Ben Cotton 2020-02-11 17:36:30 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 32 development cycle.
Changing version to 32.

Comment 7 Jerry James 2020-02-12 23:31:39 UTC
Porting is nontrivial.  In fact, the interfaces are not at all similar.  I think upstream for this package just meant that there is now a testing facility in Sphinx itself, so use that instead.

Comment 8 Miro Hrončok 2020-04-05 23:20:52 UTC
The removal of U open() mode was postponed to Python 3.10.

Closing this now.

If you haven't yet, please consider to follow up up on this with your upstream.

(This comment is mass posted to all affected bugzillas.)