Bug 2238632

Summary: straight/plugin/loaders.py: ModuleNotFoundError: No module named 'imp'
Product: [Fedora] Fedora Reporter: Miro Hrončok <mhroncok>
Component: python-straight-pluginAssignee: Pierre-YvesChibon <pingou>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 39CC: pingou, thrnciar
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: python-straight-plugin-1.5.0-23.fc40 python-straight-plugin-1.5.0-23.fc39 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-09-22 00:18:22 UTC Type: ---
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: 2135404    

Description Miro Hrončok 2023-09-12 22:05:19 UTC
This package seems to be broken on Python 3.12, see e.g. this report in FedoraReview:

$ fedora-review -b 2237913
Traceback (most recent call last):
  File "/usr/bin/fedora-review", line 22, in <module>
    from FedoraReview.review_helper import ReviewHelper
  File "/usr/lib/python3.12/site-packages/FedoraReview/review_helper.py", line 34, in <module>
    from .checks import Checks, ChecksLister
  File "/usr/lib/python3.12/site-packages/FedoraReview/checks.py", line 28, in <module>
    from straight.plugin import load  # pylint: disable=F0401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/straight/plugin/__init__.py", line 1, in <module>
    from straight.plugin import loaders 
  File "/usr/lib/python3.12/site-packages/straight/plugin/loaders.py", line 7, in <module>
    from imp import find_module                                                                                                                                
ModuleNotFoundError: No module named 'imp'

https://pagure.io/FedoraReview/issue/493


The imp module was removed from Python 3.12 after a long deprecation period.

As a stop-gap measure, please Require python3-zombie-imp. To solve this, please migrate to https://docs.python.org/3/library/importlib.html

Thanks.

Reproducible: Always

Steps to Reproduce:
1. dnf install python3-straight-plugin
2. python3 -c 'import straight.plugin'
Actual Results:  
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.12/site-packages/straight/plugin/__init__.py", line 1, in <module>
    from straight.plugin import loaders
  File "/usr/lib/python3.12/site-packages/straight/plugin/loaders.py", line 7, in <module>
    from imp import find_module
ModuleNotFoundError: No module named 'imp'


Expected Results:  
No Traceback.

Comment 1 Miro Hrončok 2023-09-12 22:11:40 UTC
https://github.com/ironfroggy/straight.plugin/pull/30 suggests this is a stray import that may be removed.

I've fedpkg prepped the Fedora package and indeed, there is no usage of imp.find_module, just the import.

Backporting the PR (which was proposed upstream over a year ago) should fix this.

Comment 3 Fedora Update System 2023-09-13 08:45:57 UTC
FEDORA-2023-e907716fb1 has been submitted as an update to Fedora 40. https://bodhi.fedoraproject.org/updates/FEDORA-2023-e907716fb1

Comment 4 Fedora Update System 2023-09-13 08:46:37 UTC
FEDORA-2023-e907716fb1 has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 5 Fedora Update System 2023-09-13 08:51:00 UTC
FEDORA-2023-0859d1ebd1 has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-0859d1ebd1

Comment 6 Fedora Update System 2023-09-14 01:46:42 UTC
FEDORA-2023-0859d1ebd1 has been pushed to the Fedora 39 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-0859d1ebd1`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-0859d1ebd1

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 7 Fedora Update System 2023-09-22 00:18:22 UTC
FEDORA-2023-0859d1ebd1 has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.