ros / meta-ros

OpenEmbedded Layers for ROS 1 and ROS 2
MIT License
391 stars 255 forks source link

[Scarthgap] Compile error for python3-vcstools #1245

Open mark-bchoi opened 3 weeks ago

mark-bchoi commented 3 weeks ago

Hi,

When I try to build python3-vcstools, I got an compile error and I fixed by patch.

ERROR: python3-vcstools-0.1.42-r0 do_compile: 'python3 setup.py bdist_wheel ' execution failed.
ERROR: python3-vcstools-0.1.42-r0 do_compile: ExecutionError('/home/bchoi/nvidia-yocto-bsp/bchoi-build/tmp/work/armv8a-oe4t-linux/python3-vcstools/0.1.42/temp/run.do_compile.3318759', 1, None, None)
ERROR: Logfile of failure stored in: /home/bchoi/nvidia-yocto-bsp/bchoi-build/tmp/work/armv8a-oe4t-linux/python3-vcstools/0.1.42/temp/log.do_compile.3318759
Log data follows:
| DEBUG: Executing shell function do_compile
| Traceback (most recent call last):
|   File "/home/bchoi/nvidia-yocto-bsp/bchoi-build/tmp/work/armv8a-oe4t-linux/python3-vcstools/0.1.42/ros-vcstools-upstream-0.1.42/setup.py", line 3, in <module>
|     import imp
| ModuleNotFoundError: No module named 'imp'
| ERROR: 'python3 setup.py bdist_wheel ' execution failed.
| WARNING: exit code 1 from a shell command.
ERROR: Task (/home/bchoi/nvidia-yocto-bsp/layers/meta-ros/meta-ros-common/recipes-infrastructure/python/python3-vcstools_0.1.42.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 2153 tasks of which 2143 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
  /home/bchoi/nvidia-yocto-bsp/layers/meta-ros/meta-ros-common/recipes-infrastructure/python/python3-vcstools_0.1.42.bb:do_compile
Summary: There were 2 ERROR messages, returning a non-zero exit code.
bchoi@ubuntu-22:~/nvidia-yocto-bsp/bchoi-build$

Patch file

--- ros-vcstools-upstream-0.1.42/setup.py.org   2019-08-09 04:25:35.000000000 +0900
+++ ros-vcstools-upstream-0.1.42/setup.py       2024-11-01 16:29:58.246517087 +0900
@@ -1,6 +1,7 @@
 from setuptools import setup

-import imp
+from pathlib import Path
+import importlib

 with open('README.rst') as readme_file:
     README = readme_file.read()
@@ -8,10 +9,12 @@
 def get_version():
     ver_file = None
     try:
-        ver_file, pathname, description = imp.find_module('__version__', ['src/vcstools'])
-        vermod = imp.load_module('__version__', ver_file, pathname, description)
-        version = vermod.version
-        return version
+        version_py = Path(__file__).parent / "src/vcstools" / "__version__.py"
+        spec = importlib.util.spec_from_file_location("version", version_py)
+        version = importlib.util.module_from_spec(spec)
+        spec.loader.exec_module(version)
+
+        return version.version
     finally:
         if ver_file is not None:
             ver_file.close()

BR.