Open Jakuje opened 2 months ago
Hmm, I don't see how the changes should affect the code. Also, this python version seems to work for me as expected...
Here you find the fix for exactly the same error message (in python 3.12).
The fix is to use importlib.import_module instead of imp. However, vpicc already uses the former (i.e. NOT imp). I suspect, that some dependency uses the imp module, which is causing the problem.
You should be able to dig into the program using something like the following:
cd vsmartcard/virtualsmartcard/src
env PYTHONPATH=$PWD python3 -m pdb vicc.in --type=relay
Not sure if I do something wrong, but attempt to run vicc
gives me the error that it can not find smartcard
module:
[root@rhel-10-0-20240318-5 vpicc]# env PYTHONPATH=$PWD python3 vicc --type=relay
Traceback (most recent call last):
File "/root/virtualsmartcard-0.9/src/vpicc/vicc", line 159, in <module>
vicc = VirtualICC(args.datasetfile, args.type, hostname, args.port,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/virtualsmartcard-0.9/src/vpicc/virtualsmartcard/VirtualSmartcard.py", line 448, in __init__
from virtualsmartcard.cards.Relay import RelayOS
File "/root/virtualsmartcard-0.9/src/vpicc/virtualsmartcard/cards/Relay.py", line 22, in <module>
import smartcard
ModuleNotFoundError: No module named 'smartcard'
Looking further into the steps what happen during the build, the error is raised while byte-compiling the python code. If I see right, this is done by invoking the py-compile
binary, which is part of the tarball and does not get updated by the system-provided one.
So the workaround is to remove the py-compile
from the tarball (can be done as part of the RPM build). The solution should be just to make sure the next release will have updated py-compile
.
Not sure how to update or avoid py-compile manually as it is automatically added, see https://www.gnu.org/software/automake/manual/html_node/Python.html. I guess, this directly depends on the version of autotools that are installed. I could try updating AC_PREREQ
, but I'm not sure if that helps...
If it is automatically added, I think just rebuilding the tarball with updated automake should do that.
for me env PYTHONPATH=$PWD python3 -m pdb vicc.in --type=relay Error: vicc.in does not exist ??? Whats wrong?
The Python 3.12 removes several parts of the importlib python/cpython#98040 causing a build failure of this package under this python version, I believe in the following code parts:
https://github.com/frankmorgner/vsmartcard/blob/d2e607f4c68c5dc69ae1d73626d89df15e8c9eaf/virtualsmartcard/src/vpicc/virtualsmartcard/VirtualSmartcard.py#L367-L376
The build failures do not look self-explanatory though:
https://download.copr.fedorainfracloud.org/results/jjelen/vsmartcard/centos-stream-10-x86_64/07317358-virtualsmartcard/builder-live.log.gz
I would like to get this fixed, but I will not get to that in coming days so contributions, help, pointers always welcomed.