Open Jakuje opened 7 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?
I found the same issue as @Jakuje described
The tarball from GitHub release virtualsmartcard-0.9
includes src/vpicc/py-compile
script which comes from an older automake and has internal version tag scriptversion=2018-03-07.03; # UTC
.
I deleted the py-compile, then autoreconf --verbose --install
copied it from my system's automake
package.
On my Ubuntu, the automake package version is 1:1.16.5-1.3ubuntu1
and it has a bit more recent py-compile
with scriptversion=2021-02-27.01; # UTC
which likely did not depend on imp
module anymore.
Also the issue is not triggered if someone do git clone for getting the source.
But if they download the vsmartcard-0.9
release tgz bundle from GitHub which includes py-compile
script from an older automake
they will see the error at make install
.
I also have the same problem on Linux Mint and Ubuntu in the latest versions with Python 3.12, after managing to compile the project, I accessed the local folder on my machine and made a local call ./vicc within the project for example, but something definitely happens in the python 3.12 so the direct call to /bin breaks in some ways
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.