Bug 2232580 - python-hdfs FTBFS with Sphinx 7.1+ in Fedora Rawhide (F40)
Summary: python-hdfs FTBFS with Sphinx 7.1+ in Fedora Rawhide (F40)
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-hdfs
Version: rawhide
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Ben Beasley
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 2225274
TreeView+ depends on / blocked
 
Reported: 2023-08-17 13:15 UTC by Karolina Surma
Modified: 2023-08-26 15:13 UTC (History)
3 users (show)

Fixed In Version: python-hdfs-2.7.2-3.fc40
Clone Of:
Environment:
Last Closed: 2023-08-26 15:13:35 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github mtth hdfs pull 206 0 None open Adjust Sphinx copyright strings to “<YEAR>, <AUTHOR>” form 2023-08-21 18:45:46 UTC
Github sphinx-doc sphinx issues 11627 0 None open `copyright` accepts different values when SOURCE_DATE_EPOCH is/is not in the environment 2023-08-21 12:11:58 UTC

Description Karolina Surma 2023-08-17 13:15:24 UTC
This is exposed via the failed documentation build, but the issue is in the project code itself.
I'm testing Sphinx 7.1.2 in Copr, I want to include it in Rawhide (F40) soon.

Reproducible: Always

Steps to Reproduce:
Test locally in mock: 
$ mock -r fedora-rawhide-x86_64 --addrepo=https://download.copr.fedorainfracloud.org/results/ksurma/sphinx-7.1.2/fedora-rawhide-x86_64/ --no-clean your.src.rpm
$ mock -r fedora-rawhide-x86_64 --addrepo=https://download.copr.fedorainfracloud.org/results/ksurma/sphinx-7.1.2/fedora-rawhide-x86_64/ shell

Actual Results:  
+ sphinx-build -b latex doc _latex -j2
Running Sphinx v7.1.2

Configuration error:
There is a programmable error in your configuration file:

Traceback (most recent call last):
  File "/builddir/build/BUILD/hdfs-2.7.2/hdfs/config.py", line 24, in <module>
    from importlib import load_source
ImportError: cannot import name 'load_source' from 'importlib' (/usr/lib64/python3.12/importlib/__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/sphinx/config.py", line 356, in eval_config_file
    exec(code, namespace)  # NoQA: S102
    ^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/hdfs-2.7.2/doc/conf.py", line 64, in <module>
    import hdfs
  File "/builddir/build/BUILD/hdfs-2.7.2/hdfs/__init__.py", line 6, in <module>
    from .config import Config, NullHandler
  File "/builddir/build/BUILD/hdfs-2.7.2/hdfs/config.py", line 27, in <module>
    from imp import load_source
ModuleNotFoundError: No module named 'imp'

Expected Results:  
Successful build

This may already be fixed upstream via: https://github.com/mtth/hdfs/pull/204

Comment 1 Ben Beasley 2023-08-18 17:39:34 UTC
(In reply to Karolina Surma from comment #0)
> This may already be fixed upstream via: https://github.com/mtth/hdfs/pull/204

I’m a little confused; that PR is already patched into the Rawhide package[1]. There should be no “from importlib import load_source” or “from imp import load_source” in the patched package sources.

Is it possible that your testing is getting an old version of the python-hdfs package somehow? When I run

> mock -r fedora-rawhide-x86_64 --addrepo=https://download.copr.fedorainfracloud.org/results/ksurma/sphinx-7.1.2/fedora-rawhide-x86_64/ --no-clean ./python-hdfs-2.7.2-2.fc40.src.rpm

the build does fail, but not as described:

> Running Sphinx v7.1.2
> making output directory... done
> 
> Extension error (sphinx.config):
> Handler <function correct_copyright_year at 0x7f5ffce7fe20> for event 'config-inited' threw an exception (exception: string index out of range)

[1] https://src.fedoraproject.org/rpms/python-hdfs/c/1e1058b80c2f7e19f7ae4e20a01d4eaef0b01099?branch=rawhide

Comment 2 Ben Beasley 2023-08-18 17:43:17 UTC
At a glance, it looks like the problem in my comment above is probably https://github.com/sphinx-doc/sphinx/issues/11514, which should be fixed by https://github.com/sphinx-doc/sphinx/pull/11524, which should be released in sphinx 7.2.0.

Comment 3 Karolina Surma 2023-08-21 09:19:00 UTC
(In reply to Ben Beasley from comment #1)
> (In reply to Karolina Surma from comment #0)
> > This may already be fixed upstream via: https://github.com/mtth/hdfs/pull/204
> 
> I’m a little confused; that PR is already patched into the Rawhide
> package[1]. There should be no “from importlib import load_source” or “from
> imp import load_source” in the patched package sources.
> 
> Is it possible that your testing is getting an old version of the
> python-hdfs package somehow? 

Yes, that's what happened. I see I was building 2.7.2-1 in Copr, so that's definitely a version behind.

(In reply to Ben Beasley from comment #2)
> At a glance, it looks like the problem in my comment above is probably
> https://github.com/sphinx-doc/sphinx/issues/11514, which should be fixed by
> https://github.com/sphinx-doc/sphinx/pull/11524, which should be released in
> sphinx 7.2.0.

The commit https://github.com/sphinx-doc/sphinx/commit/8452300d54dce2da751941d9547dd54dc03e69bf was already included in Sphinx 7.1.2 which I'm testing against. This issue has already appeared in another of Fedora's packages. Will dig into it.

Comment 4 Karolina Surma 2023-08-21 11:52:03 UTC
As Sphinx has changed the logic of parsing the `copyright` key in case SOURCE_DATE_EPOCH is set in the environment, it expects only the value in the form as documented: '2008, Author Name' (source: https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-copyright).
hdfs contains only the year: https://github.com/mtth/hdfs/blob/master/doc/conf.py#L58
In case the envvar is not set, whatever is read from `copyright`, is passed to the generated pages. The issue will never appear upstream, only downstream, in environments like the RPM build. It's an inconsistent behavior and I'm going to report it to Sphinx project. However, it may be dismissed, as the format of copyright is not as Sphinx documents (even though it doesn't validate the input).

Comment 5 Ben Beasley 2023-08-21 18:45:47 UTC
Thanks for investigating this. I proposed a PR upstream[1] to correct the copyright string syntax. I’ll give them a few days to respond before working around it downstream.

In any case, I don’t think this package needs to block your Sphinx update when it is otherwise ready to ship. The problem is well-understood, and we’ll fix it one way or another.

[1] https://github.com/mtth/hdfs/pull/206

Comment 6 Ben Beasley 2023-08-21 19:31:48 UTC
Setting NEEDINFO on myself to remind me to revisit this.

Comment 7 Ben Beasley 2023-08-26 14:53:09 UTC
Upstream hasn’t reviewed my PR for this, but I’m going to go ahead and apply it as a downstream patch for now.

Comment 8 Fedora Update System 2023-08-26 15:10:47 UTC
FEDORA-2023-202cce097f has been submitted as an update to Fedora 40. https://bodhi.fedoraproject.org/updates/FEDORA-2023-202cce097f

Comment 9 Fedora Update System 2023-08-26 15:13:35 UTC
FEDORA-2023-202cce097f has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.


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